UNPKG

2.2 kBJavaScriptView Raw
1//@private
2var ArguMintRules = (function() {
3
4 var _filePathMatcher = new RegExp("(^|\\s)(@(?:/?[^/\",@\\s]*)+/?|\"@(/?[^/\",@\\r\\n\\f\\t]*)+/?\")", "gm");
5 var _fileCache = null;
6
7 /**
8 * CTOR
9 */
10 function ArguMintRules(){
11 this.__defineGetter__("filePathMatcher", function() {
12 return _filePathMatcher;
13 });
14 }
15
16 ArguMintRules.prototype = {
17 getFileCache:function(tag) {
18 var ret = null;
19 if (tag != null && tag != '') {
20 if (_fileCache != null) {
21 ret = _fileCache[tag];
22 }
23 }
24 return ret;
25 },
26 isCached:function(tag){
27 return (tag != null && tag != '' && _fileCache[tag] != null);
28 },
29 cacheFileContent:function(tag, content) {
30 if (tag != null && tag != '') {
31
32 if (_fileCache === null) {
33 _fileCache = {}
34 }
35
36 _fileCache[tag] = content;
37 }
38 },
39 // private vars
40 // returns the prototype name for an Object. I.E. rules.protoName([]); // Array
41 protoName : function(protoVal, getFuncNames) {
42 if (protoVal != null) {
43 if (protoVal.constructor != null) {
44 protoVal = protoVal.constructor.name
45 }
46 }
47 else {
48 if (protoVal === undefined) {
49 protoVal = ArguMintRules.UDF;
50 }
51 else if (protoVal === null) {
52 protoVal = String(protoVal);
53 }
54 }
55
56 return protoVal;
57 }
58 }
59
60
61 ArguMintRules.FUNC = 'Function';
62 ArguMintRules.STR = 'String';
63 ArguMintRules.NUM = 'Number';
64 ArguMintRules.BOOL = 'Boolean';
65 ArguMintRules.ARR = 'Array';
66 ArguMintRules.OBJ = 'Object';
67 ArguMintRules.NUL = 'null';
68 ArguMintRules.UDF = 'undefined';
69 ArguMintRules.REGX = 'RegExp';
70
71 return ArguMintRules;
72
73}.call(this));
74
75
76module.exports.ArguMintRules = ArguMintRules;