| /** | ||
| * Typology types syntax: | ||
| */ | ||
| export type TypologyType = StringType | ArrayType | ObjectType | CustomValidator; | ||
| export type StringType = string; | ||
| export type ArrayType = [TypologyType]; | ||
| export interface ObjectType { | ||
| [key: string]: TypologyType; | ||
| } | ||
| export type CustomValidator = (v: unknown) => boolean; | ||
| /** | ||
| * Typology reports: | ||
| */ | ||
| export interface Report { | ||
| expected: TypologyType; | ||
| type: StringType; | ||
| value: unknown; | ||
| error?: string; | ||
| path?: (string | number)[]; | ||
| nully?: boolean; | ||
| } | ||
| /** | ||
| * Public API: | ||
| */ | ||
| export interface Typology<Type = TypologyType> { | ||
| // Constructor: | ||
| new <T = TypologyType>(types?: Record<string, T>): Typology<T>; | ||
| // Class methods / "static" methods: | ||
| check(type: Type, value: unknown): boolean; | ||
| scan(type: Type, value: unknown): Report; | ||
| get(value: any): string; | ||
| add(typeId: string, type: Type): this; | ||
| add(typeDefinition: { id: string; type: TypologyType; proto?: string[] }): this; | ||
| has(typeId: string): boolean; | ||
| isValid(type: unknown): boolean; | ||
| // Static properties: | ||
| version: string; | ||
| } | ||
| declare const types: Typology<TypologyType>; | ||
| export default types; |
+15
-6
| { | ||
| "name": "typology", | ||
| "version": "1.2.1", | ||
| "version": "1.3.0", | ||
| "description": "A data validation library for Node.js and the browser.", | ||
| "main": "typology.js", | ||
| "files": [ | ||
| "typology.js", | ||
| "typology.d.ts" | ||
| ], | ||
| "scripts": { | ||
| "test": "nyc mocha" | ||
| "test": "mocha -r ts-node/register test/unit.test.ts" | ||
| }, | ||
@@ -33,9 +37,14 @@ "husky": { | ||
| "devDependencies": { | ||
| "@types/chai": "^4.3.1", | ||
| "@types/lodash": "^4.14.182", | ||
| "@types/mocha": "^9.1.1", | ||
| "chai": "^4.3.6", | ||
| "husky": "^3.0.9", | ||
| "lodash": "^4.17.15", | ||
| "mocha": "^6.2.2", | ||
| "nyc": "^14.1.1", | ||
| "lodash": "^4.17.21", | ||
| "mocha": "^10.0.0", | ||
| "prettier": "^1.18.2", | ||
| "pretty-quick": "^2.0.0" | ||
| "pretty-quick": "^2.0.0", | ||
| "ts-node": "^10.8.2", | ||
| "typescript": "^4.7.4" | ||
| } | ||
| } |
+70
-90
@@ -15,3 +15,3 @@ /** | ||
| */ | ||
| const __nativeTypes = { "*": true }; | ||
| const __nativeTypes = { '*': true }; | ||
@@ -22,18 +22,18 @@ (function() { | ||
| const classes = [ | ||
| "Boolean", | ||
| "Number", | ||
| "String", | ||
| "Object", | ||
| "Array", | ||
| "Function", | ||
| "Arguments", | ||
| "RegExp", | ||
| "Date", | ||
| 'Boolean', | ||
| 'Number', | ||
| 'String', | ||
| 'Object', | ||
| 'Array', | ||
| 'Function', | ||
| 'Arguments', | ||
| 'RegExp', | ||
| 'Date', | ||
| // ES2015 | ||
| "Map", | ||
| "Set", | ||
| "WeakMap", | ||
| "WeakSet", | ||
| "Symbol" | ||
| 'Map', | ||
| 'Set', | ||
| 'WeakMap', | ||
| 'WeakSet', | ||
| 'Symbol' | ||
| ]; | ||
@@ -45,3 +45,3 @@ | ||
| __nativeTypes[className.toLowerCase()] = true; | ||
| __class2type["[object " + className + "]"] = className.toLowerCase(); | ||
| __class2type['[object ' + className + ']'] = className.toLowerCase(); | ||
| } | ||
@@ -60,3 +60,3 @@ })(); | ||
| ? String(value) | ||
| : __class2type[Object.prototype.toString.call(value)] || "object"; | ||
| : __class2type[Object.prototype.toString.call(value)] || 'object'; | ||
| } | ||
@@ -176,17 +176,17 @@ | ||
| if (requiredTypeOf === "string") { | ||
| a = type.replace(/^[\?\!]/, "").split(/\|/); | ||
| if (requiredTypeOf === 'string') { | ||
| a = type.replace(/^[\?\!]/, '').split(/\|/); | ||
| l = a.length; | ||
| for (i = 0; i < l; i++) | ||
| if (!__nativeTypes[a[i]] && typeof _customTypes[a[i]] === "undefined") | ||
| throw new Error("Invalid type."); | ||
| if (!__nativeTypes[a[i]] && typeof _customTypes[a[i]] === 'undefined') | ||
| throw new Error('Invalid type.'); | ||
| if (type.charAt(0) === "?") optional = true; | ||
| else if (type.charAt(0) === "!") exclusive = true; | ||
| if (type.charAt(0) === '?') optional = true; | ||
| else if (type.charAt(0) === '!') exclusive = true; | ||
| l = a.length; | ||
| for (i = 0; i < l; i++) | ||
| if (typeof _customTypes[a[i]] !== "undefined") | ||
| if (typeof _customTypes[a[i]] !== 'undefined') | ||
| if ( | ||
| typeof _customTypes[a[i]].type === "function" | ||
| typeof _customTypes[a[i]].type === 'function' | ||
| ? _customTypes[a[i]].type.call(_self, obj) === true | ||
@@ -197,4 +197,3 @@ : !this.scan(_customTypes[a[i]].type, obj).error | ||
| return { | ||
| error: | ||
| 'Expected a "' + type + '" but found a ' + '"' + a[i] + '".', | ||
| error: 'Expected a "' + type + '" but found a ' + '"' + a[i] + '".', | ||
| expected: type, | ||
@@ -215,4 +214,3 @@ type: a[i], | ||
| return { | ||
| error: | ||
| 'Expected a "' + type + '" but found a ' + '"' + typeOf + '".', | ||
| error: 'Expected a "' + type + '" but found a ' + '"' + typeOf + '".', | ||
| expected: type, | ||
@@ -230,3 +228,3 @@ type: typeOf, | ||
| } else { | ||
| hasStar = ~a.indexOf("*"); | ||
| hasStar = ~a.indexOf('*'); | ||
| hasTypeOf = ~a.indexOf(typeOf); | ||
@@ -236,10 +234,5 @@ if (exclusive && (hasStar || hasTypeOf)) | ||
| error: | ||
| 'Expected a "' + | ||
| type + | ||
| '" but found a ' + | ||
| '"' + | ||
| (hasTypeOf ? typeOf : "*") + | ||
| '".', | ||
| 'Expected a "' + type + '" but found a ' + '"' + (hasTypeOf ? typeOf : '*') + '".', | ||
| expected: type, | ||
| type: hasTypeOf ? typeOf : "*", | ||
| type: hasTypeOf ? typeOf : '*', | ||
| value: obj | ||
@@ -249,4 +242,3 @@ }; | ||
| return { | ||
| error: | ||
| 'Expected a "' + type + '" but found a ' + '"' + typeOf + '".', | ||
| error: 'Expected a "' + type + '" but found a ' + '"' + typeOf + '".', | ||
| expected: type, | ||
@@ -263,4 +255,4 @@ type: typeOf, | ||
| } | ||
| } else if (requiredTypeOf === "object") { | ||
| if (typeOf !== "object") | ||
| } else if (requiredTypeOf === 'object') { | ||
| if (typeOf !== 'object') | ||
| return { | ||
@@ -288,3 +280,3 @@ error: 'Expected an object but found a "' + typeOf + '".', | ||
| for (k = 0; k < l; k++) | ||
| if (typeof type[objKeys[k]] === "undefined") | ||
| if (typeof type[objKeys[k]] === 'undefined') | ||
| return { | ||
@@ -302,3 +294,3 @@ error: 'Unexpected key "' + objKeys[k] + '".', | ||
| }; | ||
| } else if (requiredTypeOf === "function") { | ||
| } else if (requiredTypeOf === 'function') { | ||
| const output = { | ||
@@ -311,10 +303,9 @@ expected: type, | ||
| // Just applying a function | ||
| if (!type(obj)) | ||
| output.error = "The target did not pass the given test (function)."; | ||
| if (!type(obj)) output.error = 'The target did not pass the given test (function).'; | ||
| return output; | ||
| } else if (requiredTypeOf === "array") { | ||
| if (type.length !== 1) throw new Error("Invalid type."); | ||
| } else if (requiredTypeOf === 'array') { | ||
| if (type.length !== 1) throw new Error('Invalid type.'); | ||
| if (typeOf !== "array") | ||
| if (typeOf !== 'array') | ||
| return { | ||
@@ -341,3 +332,3 @@ error: 'Expected an array but found a "' + typeOf + '".', | ||
| }; | ||
| } else throw new Error("Invalid type."); | ||
| } else throw new Error('Invalid type.'); | ||
| }; | ||
@@ -407,3 +398,3 @@ | ||
| if (arguments.length === 1) { | ||
| if (this.get(a1) === "object") { | ||
| if (this.get(a1) === 'object') { | ||
| o = a1; | ||
@@ -414,10 +405,9 @@ id = o.id; | ||
| throw new Error( | ||
| "If types.add is called with one argument, " + | ||
| "this one has to be an object." | ||
| 'If types.add is called with one argument, ' + 'this one has to be an object.' | ||
| ); | ||
| } else if (arguments.length === 2) { | ||
| if (typeof a1 !== "string" || !a1) | ||
| if (typeof a1 !== 'string' || !a1) | ||
| throw new Error( | ||
| "If types.add is called with more than one " + | ||
| "argument, the first one must be the string id." | ||
| 'If types.add is called with more than one ' + | ||
| 'argument, the first one must be the string id.' | ||
| ); | ||
@@ -427,15 +417,11 @@ else id = a1; | ||
| type = a2; | ||
| } else | ||
| throw new Error( | ||
| "types.add has to be called " + "with one or two arguments." | ||
| ); | ||
| } else throw new Error('types.add has to be called ' + 'with one or two arguments.'); | ||
| if (this.get(id) !== "string" || id.length === 0) | ||
| throw new Error("A type requires an string id."); | ||
| if (this.get(id) !== 'string' || id.length === 0) | ||
| throw new Error('A type requires an string id.'); | ||
| if (_customTypes[id] !== undefined && _customTypes[id] !== "proto") | ||
| if (_customTypes[id] !== undefined && _customTypes[id] !== 'proto') | ||
| throw new Error('The type "' + id + '" already exists.'); | ||
| if (__nativeTypes[id]) | ||
| throw new Error('"' + id + '" is a reserved type name.'); | ||
| if (__nativeTypes[id]) throw new Error('"' + id + '" is a reserved type name.'); | ||
@@ -454,7 +440,7 @@ _customTypes[id] = 1; | ||
| if (this.get(type) !== "function" && !this.isValid(type)) | ||
| if (this.get(type) !== 'function' && !this.isValid(type)) | ||
| throw new Error( | ||
| "A type requires a valid definition. " + | ||
| "This one can be a preexistant type or else " + | ||
| "a function testing given objects." | ||
| 'A type requires a valid definition. ' + | ||
| 'This one can be a preexistant type or else ' + | ||
| 'a function testing given objects.' | ||
| ); | ||
@@ -567,22 +553,17 @@ | ||
| if (typeOf === "string") { | ||
| a = type.replace(/^[\?\!]/, "").split(/\|/); | ||
| if (typeOf === 'string') { | ||
| a = type.replace(/^[\?\!]/, '').split(/\|/); | ||
| aKeys = Object.keys(a); | ||
| l = aKeys.length; | ||
| for (i = 0; i < l; i++) | ||
| if ( | ||
| !__nativeTypes[a[aKeys[i]]] && | ||
| typeof _customTypes[a[aKeys[i]]] === "undefined" | ||
| ) | ||
| if (!__nativeTypes[a[aKeys[i]]] && typeof _customTypes[a[aKeys[i]]] === 'undefined') | ||
| return false; | ||
| return true; | ||
| } else if (typeOf === "object") { | ||
| } else if (typeOf === 'object') { | ||
| typeKeys = Object.keys(type); | ||
| l = typeKeys.length; | ||
| for (k = 0; k < l; k++) | ||
| if (!this.isValid(type[typeKeys[k]])) return false; | ||
| for (k = 0; k < l; k++) if (!this.isValid(type[typeKeys[k]])) return false; | ||
| return true; | ||
| } else if (typeOf === "array") | ||
| return type.length === 1 ? this.isValid(type[0]) : false; | ||
| else if (typeOf === "function") return true; | ||
| } else if (typeOf === 'array') return type.length === 1 ? this.isValid(type[0]) : false; | ||
| else if (typeOf === 'function') return true; | ||
| else return false; | ||
@@ -598,3 +579,3 @@ }; | ||
| this.add( | ||
| "type", | ||
| 'type', | ||
| function(v) { | ||
@@ -606,7 +587,7 @@ return this.isValid(v); | ||
| // Add a type "primitive" to match every primitive types (including null): | ||
| this.add("primitive", v => v !== Object(v)); | ||
| this.add('primitive', v => v !== Object(v)); | ||
| // Adding custom types at instantiation: | ||
| defs = defs || {}; | ||
| if (this.get(defs) !== "object") throw Error("Invalid argument."); | ||
| if (this.get(defs) !== 'object') throw Error('Invalid argument.'); | ||
@@ -626,4 +607,4 @@ for (let k in defs) this.add(k, defs[k]); | ||
| // Version: | ||
| Object.defineProperty(types, "version", { | ||
| value: "1.2.1" | ||
| Object.defineProperty(types, 'version', { | ||
| value: '1.3.0' | ||
| }); | ||
@@ -635,10 +616,9 @@ | ||
| */ | ||
| if (typeof exports !== "undefined") { | ||
| if (typeof module !== "undefined" && module.exports) | ||
| exports = module.exports = types; | ||
| if (typeof exports !== 'undefined') { | ||
| if (typeof module !== 'undefined' && module.exports) exports = module.exports = types; | ||
| exports.types = types; | ||
| } else if (typeof define === "function" && define.amd) | ||
| define("typology", [], function() { | ||
| } else if (typeof define === 'function' && define.amd) | ||
| define('typology', [], function() { | ||
| return types; | ||
| }); | ||
| else scope.types = types; |
| {"/home/alexisjacomy/modules/typology/typology.js":{"path":"/home/alexisjacomy/modules/typology/typology.js","statementMap":{"0":{"start":{"line":10,"column":21},"end":{"line":10,"column":23}},"1":{"start":{"line":15,"column":22},"end":{"line":15,"column":35}},"2":{"start":{"line":17,"column":0},"end":{"line":45,"column":5}},"3":{"start":{"line":20,"column":18},"end":{"line":37,"column":3}},"4":{"start":{"line":40,"column":2},"end":{"line":44,"column":3}},"5":{"start":{"line":41,"column":4},"end":{"line":41,"column":27}},"6":{"start":{"line":42,"column":4},"end":{"line":42,"column":50}},"7":{"start":{"line":43,"column":4},"end":{"line":43,"column":73}},"8":{"start":{"line":55,"column":2},"end":{"line":57,"column":70}},"9":{"start":{"line":70,"column":16},"end":{"line":70,"column":20}},"10":{"start":{"line":75,"column":23},"end":{"line":75,"column":25}},"11":{"start":{"line":155,"column":2},"end":{"line":328,"column":4}},"12":{"start":{"line":166,"column":19},"end":{"line":166,"column":24}},"13":{"start":{"line":167,"column":20},"end":{"line":167,"column":25}},"14":{"start":{"line":169,"column":19},"end":{"line":169,"column":39}},"15":{"start":{"line":170,"column":27},"end":{"line":170,"column":48}},"16":{"start":{"line":172,"column":4},"end":{"line":327,"column":44}},"17":{"start":{"line":173,"column":6},"end":{"line":173,"column":50}},"18":{"start":{"line":174,"column":6},"end":{"line":174,"column":19}},"19":{"start":{"line":175,"column":6},"end":{"line":177,"column":43}},"20":{"start":{"line":176,"column":8},"end":{"line":177,"column":43}},"21":{"start":{"line":177,"column":10},"end":{"line":177,"column":43}},"22":{"start":{"line":179,"column":6},"end":{"line":180,"column":56}},"23":{"start":{"line":179,"column":34},"end":{"line":179,"column":50}},"24":{"start":{"line":180,"column":11},"end":{"line":180,"column":56}},"25":{"start":{"line":180,"column":39},"end":{"line":180,"column":56}},"26":{"start":{"line":182,"column":6},"end":{"line":182,"column":19}},"27":{"start":{"line":183,"column":6},"end":{"line":204,"column":11}},"28":{"start":{"line":184,"column":8},"end":{"line":204,"column":11}},"29":{"start":{"line":185,"column":10},"end":{"line":204,"column":11}},"30":{"start":{"line":190,"column":12},"end":{"line":203,"column":16}},"31":{"start":{"line":191,"column":14},"end":{"line":197,"column":16}},"32":{"start":{"line":199,"column":14},"end":{"line":203,"column":16}},"33":{"start":{"line":206,"column":6},"end":{"line":252,"column":7}},"34":{"start":{"line":207,"column":8},"end":{"line":221,"column":12}},"35":{"start":{"line":208,"column":10},"end":{"line":214,"column":12}},"36":{"start":{"line":216,"column":10},"end":{"line":221,"column":12}},"37":{"start":{"line":223,"column":8},"end":{"line":223,"column":34}},"38":{"start":{"line":224,"column":8},"end":{"line":224,"column":39}},"39":{"start":{"line":225,"column":8},"end":{"line":251,"column":12}},"40":{"start":{"line":226,"column":10},"end":{"line":237,"column":12}},"41":{"start":{"line":238,"column":13},"end":{"line":251,"column":12}},"42":{"start":{"line":239,"column":10},"end":{"line":245,"column":12}},"43":{"start":{"line":247,"column":10},"end":{"line":251,"column":12}},"44":{"start":{"line":253,"column":11},"end":{"line":327,"column":44}},"45":{"start":{"line":254,"column":6},"end":{"line":260,"column":10}},"46":{"start":{"line":255,"column":8},"end":{"line":260,"column":10}},"47":{"start":{"line":262,"column":6},"end":{"line":262,"column":35}},"48":{"start":{"line":263,"column":6},"end":{"line":263,"column":26}},"49":{"start":{"line":264,"column":6},"end":{"line":264,"column":16}},"50":{"start":{"line":265,"column":6},"end":{"line":271,"column":7}},"51":{"start":{"line":266,"column":8},"end":{"line":266,"column":61}},"52":{"start":{"line":267,"column":8},"end":{"line":270,"column":38}},"53":{"start":{"line":268,"column":10},"end":{"line":268,"column":79}},"54":{"start":{"line":269,"column":10},"end":{"line":269,"column":21}},"55":{"start":{"line":270,"column":15},"end":{"line":270,"column":38}},"56":{"start":{"line":270,"column":30},"end":{"line":270,"column":38}},"57":{"start":{"line":273,"column":6},"end":{"line":273,"column":33}},"58":{"start":{"line":274,"column":6},"end":{"line":284,"column":7}},"59":{"start":{"line":275,"column":8},"end":{"line":275,"column":27}},"60":{"start":{"line":276,"column":8},"end":{"line":283,"column":14}},"61":{"start":{"line":277,"column":10},"end":{"line":283,"column":14}},"62":{"start":{"line":278,"column":12},"end":{"line":283,"column":14}},"63":{"start":{"line":285,"column":6},"end":{"line":289,"column":8}},"64":{"start":{"line":290,"column":11},"end":{"line":327,"column":44}},"65":{"start":{"line":291,"column":21},"end":{"line":295,"column":7}},"66":{"start":{"line":298,"column":6},"end":{"line":299,"column":76}},"67":{"start":{"line":299,"column":8},"end":{"line":299,"column":76}},"68":{"start":{"line":301,"column":6},"end":{"line":301,"column":20}},"69":{"start":{"line":302,"column":11},"end":{"line":327,"column":44}},"70":{"start":{"line":303,"column":6},"end":{"line":303,"column":62}},"71":{"start":{"line":303,"column":29},"end":{"line":303,"column":62}},"72":{"start":{"line":305,"column":6},"end":{"line":311,"column":10}},"73":{"start":{"line":306,"column":8},"end":{"line":311,"column":10}},"74":{"start":{"line":313,"column":6},"end":{"line":313,"column":21}},"75":{"start":{"line":314,"column":6},"end":{"line":320,"column":7}},"76":{"start":{"line":315,"column":8},"end":{"line":315,"column":41}},"77":{"start":{"line":316,"column":8},"end":{"line":319,"column":9}},"78":{"start":{"line":317,"column":10},"end":{"line":317,"column":59}},"79":{"start":{"line":318,"column":10},"end":{"line":318,"column":21}},"80":{"start":{"line":322,"column":6},"end":{"line":326,"column":8}},"81":{"start":{"line":327,"column":11},"end":{"line":327,"column":44}},"82":{"start":{"line":382,"column":2},"end":{"line":458,"column":4}},"83":{"start":{"line":391,"column":4},"end":{"line":413,"column":8}},"84":{"start":{"line":392,"column":6},"end":{"line":400,"column":10}},"85":{"start":{"line":393,"column":8},"end":{"line":393,"column":15}},"86":{"start":{"line":394,"column":8},"end":{"line":394,"column":18}},"87":{"start":{"line":395,"column":8},"end":{"line":395,"column":22}},"88":{"start":{"line":397,"column":8},"end":{"line":400,"column":10}},"89":{"start":{"line":401,"column":11},"end":{"line":413,"column":8}},"90":{"start":{"line":402,"column":6},"end":{"line":407,"column":19}},"91":{"start":{"line":403,"column":8},"end":{"line":406,"column":10}},"92":{"start":{"line":407,"column":11},"end":{"line":407,"column":19}},"93":{"start":{"line":409,"column":6},"end":{"line":409,"column":16}},"94":{"start":{"line":411,"column":6},"end":{"line":413,"column":8}},"95":{"start":{"line":415,"column":4},"end":{"line":416,"column":55}},"96":{"start":{"line":416,"column":6},"end":{"line":416,"column":55}},"97":{"start":{"line":418,"column":4},"end":{"line":419,"column":63}},"98":{"start":{"line":419,"column":6},"end":{"line":419,"column":63}},"99":{"start":{"line":421,"column":4},"end":{"line":422,"column":63}},"100":{"start":{"line":422,"column":6},"end":{"line":422,"column":63}},"101":{"start":{"line":424,"column":4},"end":{"line":424,"column":25}},"102":{"start":{"line":427,"column":4},"end":{"line":427,"column":30}},"103":{"start":{"line":428,"column":4},"end":{"line":428,"column":35}},"104":{"start":{"line":429,"column":4},"end":{"line":429,"column":13}},"105":{"start":{"line":430,"column":4},"end":{"line":434,"column":7}},"106":{"start":{"line":431,"column":6},"end":{"line":434,"column":7}},"107":{"start":{"line":432,"column":8},"end":{"line":432,"column":31}},"108":{"start":{"line":433,"column":8},"end":{"line":433,"column":22}},"109":{"start":{"line":436,"column":4},"end":{"line":441,"column":8}},"110":{"start":{"line":437,"column":6},"end":{"line":441,"column":8}},"111":{"start":{"line":444,"column":4},"end":{"line":450,"column":13}},"112":{"start":{"line":452,"column":4},"end":{"line":452,"column":65}},"113":{"start":{"line":452,"column":25},"end":{"line":452,"column":65}},"114":{"start":{"line":452,"column":38},"end":{"line":452,"column":65}},"115":{"start":{"line":455,"column":4},"end":{"line":455,"column":56}},"116":{"start":{"line":455,"column":19},"end":{"line":455,"column":56}},"117":{"start":{"line":455,"column":33},"end":{"line":455,"column":56}},"118":{"start":{"line":457,"column":4},"end":{"line":457,"column":16}},"119":{"start":{"line":467,"column":2},"end":{"line":469,"column":4}},"120":{"start":{"line":468,"column":4},"end":{"line":468,"column":31}},"121":{"start":{"line":484,"column":2},"end":{"line":484,"column":29}},"122":{"start":{"line":506,"column":2},"end":{"line":508,"column":4}},"123":{"start":{"line":507,"column":4},"end":{"line":507,"column":39}},"124":{"start":{"line":538,"column":2},"end":{"line":569,"column":4}},"125":{"start":{"line":546,"column":19},"end":{"line":546,"column":40}},"126":{"start":{"line":548,"column":4},"end":{"line":568,"column":22}},"127":{"start":{"line":549,"column":6},"end":{"line":549,"column":50}},"128":{"start":{"line":550,"column":6},"end":{"line":550,"column":29}},"129":{"start":{"line":551,"column":6},"end":{"line":551,"column":23}},"130":{"start":{"line":552,"column":6},"end":{"line":557,"column":23}},"131":{"start":{"line":553,"column":8},"end":{"line":557,"column":23}},"132":{"start":{"line":557,"column":10},"end":{"line":557,"column":23}},"133":{"start":{"line":558,"column":6},"end":{"line":558,"column":18}},"134":{"start":{"line":559,"column":11},"end":{"line":568,"column":22}},"135":{"start":{"line":560,"column":6},"end":{"line":560,"column":35}},"136":{"start":{"line":561,"column":6},"end":{"line":561,"column":26}},"137":{"start":{"line":562,"column":6},"end":{"line":563,"column":59}},"138":{"start":{"line":563,"column":8},"end":{"line":563,"column":59}},"139":{"start":{"line":563,"column":46},"end":{"line":563,"column":59}},"140":{"start":{"line":564,"column":6},"end":{"line":564,"column":18}},"141":{"start":{"line":565,"column":11},"end":{"line":568,"column":22}},"142":{"start":{"line":566,"column":6},"end":{"line":566,"column":63}},"143":{"start":{"line":567,"column":9},"end":{"line":568,"column":22}},"144":{"start":{"line":567,"column":36},"end":{"line":567,"column":48}},"145":{"start":{"line":568,"column":9},"end":{"line":568,"column":22}},"146":{"start":{"line":577,"column":2},"end":{"line":582,"column":4}},"147":{"start":{"line":580,"column":6},"end":{"line":580,"column":29}},"148":{"start":{"line":585,"column":2},"end":{"line":585,"column":46}},"149":{"start":{"line":585,"column":29},"end":{"line":585,"column":44}},"150":{"start":{"line":588,"column":2},"end":{"line":588,"column":20}},"151":{"start":{"line":589,"column":2},"end":{"line":589,"column":68}},"152":{"start":{"line":589,"column":35},"end":{"line":589,"column":68}},"153":{"start":{"line":591,"column":2},"end":{"line":591,"column":43}},"154":{"start":{"line":591,"column":22},"end":{"line":591,"column":43}},"155":{"start":{"line":600,"column":14},"end":{"line":600,"column":22}},"156":{"start":{"line":601,"column":0},"end":{"line":601,"column":21}},"157":{"start":{"line":604,"column":0},"end":{"line":606,"column":3}},"158":{"start":{"line":612,"column":0},"end":{"line":620,"column":25}},"159":{"start":{"line":613,"column":2},"end":{"line":614,"column":37}},"160":{"start":{"line":614,"column":4},"end":{"line":614,"column":37}},"161":{"start":{"line":615,"column":2},"end":{"line":615,"column":24}},"162":{"start":{"line":616,"column":7},"end":{"line":620,"column":25}},"163":{"start":{"line":617,"column":2},"end":{"line":619,"column":5}},"164":{"start":{"line":618,"column":4},"end":{"line":618,"column":17}},"165":{"start":{"line":620,"column":5},"end":{"line":620,"column":25}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":17,"column":1},"end":{"line":17,"column":2}},"loc":{"start":{"line":17,"column":12},"end":{"line":45,"column":1}},"line":17},"1":{"name":"__getNativeType","decl":{"start":{"line":54,"column":9},"end":{"line":54,"column":24}},"loc":{"start":{"line":54,"column":32},"end":{"line":58,"column":1}},"line":54},"2":{"name":"Typology","decl":{"start":{"line":64,"column":9},"end":{"line":64,"column":17}},"loc":{"start":{"line":64,"column":24},"end":{"line":592,"column":1}},"line":64},"3":{"name":"(anonymous_3)","decl":{"start":{"line":155,"column":14},"end":{"line":155,"column":15}},"loc":{"start":{"line":155,"column":34},"end":{"line":328,"column":3}},"line":155},"4":{"name":"(anonymous_4)","decl":{"start":{"line":382,"column":13},"end":{"line":382,"column":14}},"loc":{"start":{"line":382,"column":30},"end":{"line":458,"column":3}},"line":382},"5":{"name":"(anonymous_5)","decl":{"start":{"line":467,"column":13},"end":{"line":467,"column":14}},"loc":{"start":{"line":467,"column":27},"end":{"line":469,"column":3}},"line":467},"6":{"name":"(anonymous_6)","decl":{"start":{"line":506,"column":15},"end":{"line":506,"column":16}},"loc":{"start":{"line":506,"column":35},"end":{"line":508,"column":3}},"line":506},"7":{"name":"(anonymous_7)","decl":{"start":{"line":538,"column":17},"end":{"line":538,"column":18}},"loc":{"start":{"line":538,"column":32},"end":{"line":569,"column":3}},"line":538},"8":{"name":"(anonymous_8)","decl":{"start":{"line":579,"column":4},"end":{"line":579,"column":5}},"loc":{"start":{"line":579,"column":16},"end":{"line":581,"column":5}},"line":579},"9":{"name":"(anonymous_9)","decl":{"start":{"line":585,"column":24},"end":{"line":585,"column":25}},"loc":{"start":{"line":585,"column":29},"end":{"line":585,"column":44}},"line":585},"10":{"name":"(anonymous_10)","decl":{"start":{"line":617,"column":25},"end":{"line":617,"column":26}},"loc":{"start":{"line":617,"column":36},"end":{"line":619,"column":3}},"line":617}},"branchMap":{"0":{"loc":{"start":{"line":55,"column":9},"end":{"line":57,"column":69}},"type":"cond-expr","locations":[{"start":{"line":56,"column":6},"end":{"line":56,"column":19}},{"start":{"line":57,"column":6},"end":{"line":57,"column":69}}],"line":55},"1":{"loc":{"start":{"line":55,"column":9},"end":{"line":55,"column":46}},"type":"binary-expr","locations":[{"start":{"line":55,"column":9},"end":{"line":55,"column":23}},{"start":{"line":55,"column":27},"end":{"line":55,"column":46}}],"line":55},"2":{"loc":{"start":{"line":57,"column":6},"end":{"line":57,"column":69}},"type":"binary-expr","locations":[{"start":{"line":57,"column":6},"end":{"line":57,"column":57}},{"start":{"line":57,"column":61},"end":{"line":57,"column":69}}],"line":57},"3":{"loc":{"start":{"line":172,"column":4},"end":{"line":327,"column":44}},"type":"if","locations":[{"start":{"line":172,"column":4},"end":{"line":327,"column":44}},{"start":{"line":172,"column":4},"end":{"line":327,"column":44}}],"line":172},"4":{"loc":{"start":{"line":176,"column":8},"end":{"line":177,"column":43}},"type":"if","locations":[{"start":{"line":176,"column":8},"end":{"line":177,"column":43}},{"start":{"line":176,"column":8},"end":{"line":177,"column":43}}],"line":176},"5":{"loc":{"start":{"line":176,"column":12},"end":{"line":176,"column":77}},"type":"binary-expr","locations":[{"start":{"line":176,"column":12},"end":{"line":176,"column":32}},{"start":{"line":176,"column":36},"end":{"line":176,"column":77}}],"line":176},"6":{"loc":{"start":{"line":179,"column":6},"end":{"line":180,"column":56}},"type":"if","locations":[{"start":{"line":179,"column":6},"end":{"line":180,"column":56}},{"start":{"line":179,"column":6},"end":{"line":180,"column":56}}],"line":179},"7":{"loc":{"start":{"line":180,"column":11},"end":{"line":180,"column":56}},"type":"if","locations":[{"start":{"line":180,"column":11},"end":{"line":180,"column":56}},{"start":{"line":180,"column":11},"end":{"line":180,"column":56}}],"line":180},"8":{"loc":{"start":{"line":184,"column":8},"end":{"line":204,"column":11}},"type":"if","locations":[{"start":{"line":184,"column":8},"end":{"line":204,"column":11}},{"start":{"line":184,"column":8},"end":{"line":204,"column":11}}],"line":184},"9":{"loc":{"start":{"line":185,"column":10},"end":{"line":204,"column":11}},"type":"if","locations":[{"start":{"line":185,"column":10},"end":{"line":204,"column":11}},{"start":{"line":185,"column":10},"end":{"line":204,"column":11}}],"line":185},"10":{"loc":{"start":{"line":186,"column":12},"end":{"line":188,"column":62}},"type":"cond-expr","locations":[{"start":{"line":187,"column":16},"end":{"line":187,"column":65}},{"start":{"line":188,"column":16},"end":{"line":188,"column":62}}],"line":186},"11":{"loc":{"start":{"line":190,"column":12},"end":{"line":203,"column":16}},"type":"if","locations":[{"start":{"line":190,"column":12},"end":{"line":203,"column":16}},{"start":{"line":190,"column":12},"end":{"line":203,"column":16}}],"line":190},"12":{"loc":{"start":{"line":206,"column":6},"end":{"line":252,"column":7}},"type":"if","locations":[{"start":{"line":206,"column":6},"end":{"line":252,"column":7}},{"start":{"line":206,"column":6},"end":{"line":252,"column":7}}],"line":206},"13":{"loc":{"start":{"line":206,"column":10},"end":{"line":206,"column":43}},"type":"binary-expr","locations":[{"start":{"line":206,"column":10},"end":{"line":206,"column":22}},{"start":{"line":206,"column":26},"end":{"line":206,"column":43}}],"line":206},"14":{"loc":{"start":{"line":207,"column":8},"end":{"line":221,"column":12}},"type":"if","locations":[{"start":{"line":207,"column":8},"end":{"line":221,"column":12}},{"start":{"line":207,"column":8},"end":{"line":221,"column":12}}],"line":207},"15":{"loc":{"start":{"line":207,"column":12},"end":{"line":207,"column":35}},"type":"binary-expr","locations":[{"start":{"line":207,"column":12},"end":{"line":207,"column":22}},{"start":{"line":207,"column":26},"end":{"line":207,"column":35}}],"line":207},"16":{"loc":{"start":{"line":225,"column":8},"end":{"line":251,"column":12}},"type":"if","locations":[{"start":{"line":225,"column":8},"end":{"line":251,"column":12}},{"start":{"line":225,"column":8},"end":{"line":251,"column":12}}],"line":225},"17":{"loc":{"start":{"line":225,"column":12},"end":{"line":225,"column":47}},"type":"binary-expr","locations":[{"start":{"line":225,"column":12},"end":{"line":225,"column":21}},{"start":{"line":225,"column":26},"end":{"line":225,"column":33}},{"start":{"line":225,"column":37},"end":{"line":225,"column":46}}],"line":225},"18":{"loc":{"start":{"line":232,"column":15},"end":{"line":232,"column":39}},"type":"cond-expr","locations":[{"start":{"line":232,"column":27},"end":{"line":232,"column":33}},{"start":{"line":232,"column":36},"end":{"line":232,"column":39}}],"line":232},"19":{"loc":{"start":{"line":235,"column":18},"end":{"line":235,"column":42}},"type":"cond-expr","locations":[{"start":{"line":235,"column":30},"end":{"line":235,"column":36}},{"start":{"line":235,"column":39},"end":{"line":235,"column":42}}],"line":235},"20":{"loc":{"start":{"line":238,"column":13},"end":{"line":251,"column":12}},"type":"if","locations":[{"start":{"line":238,"column":13},"end":{"line":251,"column":12}},{"start":{"line":238,"column":13},"end":{"line":251,"column":12}}],"line":238},"21":{"loc":{"start":{"line":238,"column":17},"end":{"line":238,"column":54}},"type":"binary-expr","locations":[{"start":{"line":238,"column":17},"end":{"line":238,"column":27}},{"start":{"line":238,"column":31},"end":{"line":238,"column":54}}],"line":238},"22":{"loc":{"start":{"line":238,"column":33},"end":{"line":238,"column":53}},"type":"binary-expr","locations":[{"start":{"line":238,"column":33},"end":{"line":238,"column":40}},{"start":{"line":238,"column":44},"end":{"line":238,"column":53}}],"line":238},"23":{"loc":{"start":{"line":253,"column":11},"end":{"line":327,"column":44}},"type":"if","locations":[{"start":{"line":253,"column":11},"end":{"line":327,"column":44}},{"start":{"line":253,"column":11},"end":{"line":327,"column":44}}],"line":253},"24":{"loc":{"start":{"line":254,"column":6},"end":{"line":260,"column":10}},"type":"if","locations":[{"start":{"line":254,"column":6},"end":{"line":260,"column":10}},{"start":{"line":254,"column":6},"end":{"line":260,"column":10}}],"line":254},"25":{"loc":{"start":{"line":267,"column":8},"end":{"line":270,"column":38}},"type":"if","locations":[{"start":{"line":267,"column":8},"end":{"line":270,"column":38}},{"start":{"line":267,"column":8},"end":{"line":270,"column":38}}],"line":267},"26":{"loc":{"start":{"line":268,"column":21},"end":{"line":268,"column":78}},"type":"cond-expr","locations":[{"start":{"line":268,"column":32},"end":{"line":268,"column":62}},{"start":{"line":268,"column":65},"end":{"line":268,"column":78}}],"line":268},"27":{"loc":{"start":{"line":270,"column":15},"end":{"line":270,"column":38}},"type":"if","locations":[{"start":{"line":270,"column":15},"end":{"line":270,"column":38}},{"start":{"line":270,"column":15},"end":{"line":270,"column":38}}],"line":270},"28":{"loc":{"start":{"line":274,"column":6},"end":{"line":284,"column":7}},"type":"if","locations":[{"start":{"line":274,"column":6},"end":{"line":284,"column":7}},{"start":{"line":274,"column":6},"end":{"line":284,"column":7}}],"line":274},"29":{"loc":{"start":{"line":277,"column":10},"end":{"line":283,"column":14}},"type":"if","locations":[{"start":{"line":277,"column":10},"end":{"line":283,"column":14}},{"start":{"line":277,"column":10},"end":{"line":283,"column":14}}],"line":277},"30":{"loc":{"start":{"line":290,"column":11},"end":{"line":327,"column":44}},"type":"if","locations":[{"start":{"line":290,"column":11},"end":{"line":327,"column":44}},{"start":{"line":290,"column":11},"end":{"line":327,"column":44}}],"line":290},"31":{"loc":{"start":{"line":298,"column":6},"end":{"line":299,"column":76}},"type":"if","locations":[{"start":{"line":298,"column":6},"end":{"line":299,"column":76}},{"start":{"line":298,"column":6},"end":{"line":299,"column":76}}],"line":298},"32":{"loc":{"start":{"line":302,"column":11},"end":{"line":327,"column":44}},"type":"if","locations":[{"start":{"line":302,"column":11},"end":{"line":327,"column":44}},{"start":{"line":302,"column":11},"end":{"line":327,"column":44}}],"line":302},"33":{"loc":{"start":{"line":303,"column":6},"end":{"line":303,"column":62}},"type":"if","locations":[{"start":{"line":303,"column":6},"end":{"line":303,"column":62}},{"start":{"line":303,"column":6},"end":{"line":303,"column":62}}],"line":303},"34":{"loc":{"start":{"line":305,"column":6},"end":{"line":311,"column":10}},"type":"if","locations":[{"start":{"line":305,"column":6},"end":{"line":311,"column":10}},{"start":{"line":305,"column":6},"end":{"line":311,"column":10}}],"line":305},"35":{"loc":{"start":{"line":316,"column":8},"end":{"line":319,"column":9}},"type":"if","locations":[{"start":{"line":316,"column":8},"end":{"line":319,"column":9}},{"start":{"line":316,"column":8},"end":{"line":319,"column":9}}],"line":316},"36":{"loc":{"start":{"line":317,"column":21},"end":{"line":317,"column":58}},"type":"cond-expr","locations":[{"start":{"line":317,"column":32},"end":{"line":317,"column":52}},{"start":{"line":317,"column":55},"end":{"line":317,"column":58}}],"line":317},"37":{"loc":{"start":{"line":391,"column":4},"end":{"line":413,"column":8}},"type":"if","locations":[{"start":{"line":391,"column":4},"end":{"line":413,"column":8}},{"start":{"line":391,"column":4},"end":{"line":413,"column":8}}],"line":391},"38":{"loc":{"start":{"line":392,"column":6},"end":{"line":400,"column":10}},"type":"if","locations":[{"start":{"line":392,"column":6},"end":{"line":400,"column":10}},{"start":{"line":392,"column":6},"end":{"line":400,"column":10}}],"line":392},"39":{"loc":{"start":{"line":401,"column":11},"end":{"line":413,"column":8}},"type":"if","locations":[{"start":{"line":401,"column":11},"end":{"line":413,"column":8}},{"start":{"line":401,"column":11},"end":{"line":413,"column":8}}],"line":401},"40":{"loc":{"start":{"line":402,"column":6},"end":{"line":407,"column":19}},"type":"if","locations":[{"start":{"line":402,"column":6},"end":{"line":407,"column":19}},{"start":{"line":402,"column":6},"end":{"line":407,"column":19}}],"line":402},"41":{"loc":{"start":{"line":402,"column":10},"end":{"line":402,"column":39}},"type":"binary-expr","locations":[{"start":{"line":402,"column":10},"end":{"line":402,"column":32}},{"start":{"line":402,"column":36},"end":{"line":402,"column":39}}],"line":402},"42":{"loc":{"start":{"line":415,"column":4},"end":{"line":416,"column":55}},"type":"if","locations":[{"start":{"line":415,"column":4},"end":{"line":416,"column":55}},{"start":{"line":415,"column":4},"end":{"line":416,"column":55}}],"line":415},"43":{"loc":{"start":{"line":415,"column":8},"end":{"line":415,"column":52}},"type":"binary-expr","locations":[{"start":{"line":415,"column":8},"end":{"line":415,"column":33}},{"start":{"line":415,"column":37},"end":{"line":415,"column":52}}],"line":415},"44":{"loc":{"start":{"line":418,"column":4},"end":{"line":419,"column":63}},"type":"if","locations":[{"start":{"line":418,"column":4},"end":{"line":419,"column":63}},{"start":{"line":418,"column":4},"end":{"line":419,"column":63}}],"line":418},"45":{"loc":{"start":{"line":418,"column":8},"end":{"line":418,"column":70}},"type":"binary-expr","locations":[{"start":{"line":418,"column":8},"end":{"line":418,"column":38}},{"start":{"line":418,"column":42},"end":{"line":418,"column":70}}],"line":418},"46":{"loc":{"start":{"line":421,"column":4},"end":{"line":422,"column":63}},"type":"if","locations":[{"start":{"line":421,"column":4},"end":{"line":422,"column":63}},{"start":{"line":421,"column":4},"end":{"line":422,"column":63}}],"line":421},"47":{"loc":{"start":{"line":427,"column":8},"end":{"line":427,"column":29}},"type":"binary-expr","locations":[{"start":{"line":427,"column":8},"end":{"line":427,"column":23}},{"start":{"line":427,"column":27},"end":{"line":427,"column":29}}],"line":427},"48":{"loc":{"start":{"line":427,"column":9},"end":{"line":427,"column":16}},"type":"binary-expr","locations":[{"start":{"line":427,"column":9},"end":{"line":427,"column":10}},{"start":{"line":427,"column":14},"end":{"line":427,"column":16}}],"line":427},"49":{"loc":{"start":{"line":428,"column":8},"end":{"line":428,"column":34}},"type":"cond-expr","locations":[{"start":{"line":428,"column":27},"end":{"line":428,"column":28}},{"start":{"line":428,"column":31},"end":{"line":428,"column":34}}],"line":428},"50":{"loc":{"start":{"line":431,"column":6},"end":{"line":434,"column":7}},"type":"if","locations":[{"start":{"line":431,"column":6},"end":{"line":434,"column":7}},{"start":{"line":431,"column":6},"end":{"line":434,"column":7}}],"line":431},"51":{"loc":{"start":{"line":436,"column":4},"end":{"line":441,"column":8}},"type":"if","locations":[{"start":{"line":436,"column":4},"end":{"line":441,"column":8}},{"start":{"line":436,"column":4},"end":{"line":441,"column":8}}],"line":436},"52":{"loc":{"start":{"line":436,"column":8},"end":{"line":436,"column":60}},"type":"binary-expr","locations":[{"start":{"line":436,"column":8},"end":{"line":436,"column":37}},{"start":{"line":436,"column":41},"end":{"line":436,"column":60}}],"line":436},"53":{"loc":{"start":{"line":445,"column":6},"end":{"line":450,"column":12}},"type":"cond-expr","locations":[{"start":{"line":446,"column":10},"end":{"line":449,"column":11}},{"start":{"line":450,"column":10},"end":{"line":450,"column":12}}],"line":445},"54":{"loc":{"start":{"line":452,"column":4},"end":{"line":452,"column":65}},"type":"if","locations":[{"start":{"line":452,"column":4},"end":{"line":452,"column":65}},{"start":{"line":452,"column":4},"end":{"line":452,"column":65}}],"line":452},"55":{"loc":{"start":{"line":455,"column":19},"end":{"line":455,"column":56}},"type":"if","locations":[{"start":{"line":455,"column":19},"end":{"line":455,"column":56}},{"start":{"line":455,"column":19},"end":{"line":455,"column":56}}],"line":455},"56":{"loc":{"start":{"line":548,"column":4},"end":{"line":568,"column":22}},"type":"if","locations":[{"start":{"line":548,"column":4},"end":{"line":568,"column":22}},{"start":{"line":548,"column":4},"end":{"line":568,"column":22}}],"line":548},"57":{"loc":{"start":{"line":553,"column":8},"end":{"line":557,"column":23}},"type":"if","locations":[{"start":{"line":553,"column":8},"end":{"line":557,"column":23}},{"start":{"line":553,"column":8},"end":{"line":557,"column":23}}],"line":553},"58":{"loc":{"start":{"line":554,"column":10},"end":{"line":555,"column":58}},"type":"binary-expr","locations":[{"start":{"line":554,"column":10},"end":{"line":554,"column":37}},{"start":{"line":555,"column":10},"end":{"line":555,"column":58}}],"line":554},"59":{"loc":{"start":{"line":559,"column":11},"end":{"line":568,"column":22}},"type":"if","locations":[{"start":{"line":559,"column":11},"end":{"line":568,"column":22}},{"start":{"line":559,"column":11},"end":{"line":568,"column":22}}],"line":559},"60":{"loc":{"start":{"line":563,"column":8},"end":{"line":563,"column":59}},"type":"if","locations":[{"start":{"line":563,"column":8},"end":{"line":563,"column":59}},{"start":{"line":563,"column":8},"end":{"line":563,"column":59}}],"line":563},"61":{"loc":{"start":{"line":565,"column":11},"end":{"line":568,"column":22}},"type":"if","locations":[{"start":{"line":565,"column":11},"end":{"line":568,"column":22}},{"start":{"line":565,"column":11},"end":{"line":568,"column":22}}],"line":565},"62":{"loc":{"start":{"line":566,"column":13},"end":{"line":566,"column":62}},"type":"cond-expr","locations":[{"start":{"line":566,"column":33},"end":{"line":566,"column":54}},{"start":{"line":566,"column":57},"end":{"line":566,"column":62}}],"line":566},"63":{"loc":{"start":{"line":567,"column":9},"end":{"line":568,"column":22}},"type":"if","locations":[{"start":{"line":567,"column":9},"end":{"line":568,"column":22}},{"start":{"line":567,"column":9},"end":{"line":568,"column":22}}],"line":567},"64":{"loc":{"start":{"line":588,"column":9},"end":{"line":588,"column":19}},"type":"binary-expr","locations":[{"start":{"line":588,"column":9},"end":{"line":588,"column":13}},{"start":{"line":588,"column":17},"end":{"line":588,"column":19}}],"line":588},"65":{"loc":{"start":{"line":589,"column":2},"end":{"line":589,"column":68}},"type":"if","locations":[{"start":{"line":589,"column":2},"end":{"line":589,"column":68}},{"start":{"line":589,"column":2},"end":{"line":589,"column":68}}],"line":589},"66":{"loc":{"start":{"line":612,"column":0},"end":{"line":620,"column":25}},"type":"if","locations":[{"start":{"line":612,"column":0},"end":{"line":620,"column":25}},{"start":{"line":612,"column":0},"end":{"line":620,"column":25}}],"line":612},"67":{"loc":{"start":{"line":613,"column":2},"end":{"line":614,"column":37}},"type":"if","locations":[{"start":{"line":613,"column":2},"end":{"line":614,"column":37}},{"start":{"line":613,"column":2},"end":{"line":614,"column":37}}],"line":613},"68":{"loc":{"start":{"line":613,"column":6},"end":{"line":613,"column":53}},"type":"binary-expr","locations":[{"start":{"line":613,"column":6},"end":{"line":613,"column":35}},{"start":{"line":613,"column":39},"end":{"line":613,"column":53}}],"line":613},"69":{"loc":{"start":{"line":616,"column":7},"end":{"line":620,"column":25}},"type":"if","locations":[{"start":{"line":616,"column":7},"end":{"line":620,"column":25}},{"start":{"line":616,"column":7},"end":{"line":620,"column":25}}],"line":616},"70":{"loc":{"start":{"line":616,"column":11},"end":{"line":616,"column":53}},"type":"binary-expr","locations":[{"start":{"line":616,"column":11},"end":{"line":616,"column":39}},{"start":{"line":616,"column":43},"end":{"line":616,"column":53}}],"line":616}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":14,"6":14,"7":14,"8":545,"9":4,"10":4,"11":4,"12":208,"13":208,"14":208,"15":208,"16":208,"17":140,"18":140,"19":140,"20":154,"21":2,"22":138,"23":38,"24":100,"25":7,"26":138,"27":138,"28":151,"29":59,"30":31,"31":3,"32":28,"33":107,"34":20,"35":5,"36":15,"37":87,"38":87,"39":87,"40":1,"41":86,"42":35,"43":51,"44":68,"45":57,"46":10,"47":47,"48":47,"49":47,"50":47,"51":64,"52":63,"53":13,"54":13,"55":50,"56":12,"57":33,"58":33,"59":6,"60":6,"61":12,"62":5,"63":28,"64":11,"65":4,"66":4,"67":2,"68":4,"69":7,"70":7,"71":0,"72":7,"73":1,"74":6,"75":6,"76":10,"77":10,"78":2,"79":2,"80":4,"81":0,"82":4,"83":19,"84":2,"85":2,"86":2,"87":2,"88":0,"89":17,"90":17,"91":0,"92":17,"93":17,"94":0,"95":19,"96":0,"97":19,"98":0,"99":19,"100":1,"101":18,"102":18,"103":18,"104":18,"105":18,"106":1,"107":1,"108":1,"109":18,"110":0,"111":18,"112":18,"113":2,"114":5,"115":18,"116":1,"117":1,"118":18,"119":4,"120":0,"121":4,"122":4,"123":97,"124":4,"125":75,"126":75,"127":58,"128":58,"129":58,"130":58,"131":67,"132":13,"133":45,"134":17,"135":12,"136":12,"137":12,"138":20,"139":1,"140":11,"141":5,"142":4,"143":1,"144":1,"145":0,"146":4,"147":2,"148":4,"149":12,"150":4,"151":4,"152":1,"153":3,"154":1,"155":1,"156":1,"157":1,"158":1,"159":1,"160":1,"161":1,"162":0,"163":0,"164":0,"165":0},"f":{"0":1,"1":545,"2":4,"3":208,"4":19,"5":0,"6":97,"7":75,"8":2,"9":12,"10":0},"b":{"0":[33,512],"1":[545,537],"2":[512,0],"3":[140,68],"4":[2,152],"5":[154,61],"6":[38,100],"7":[7,93],"8":[59,92],"9":[31,28],"10":[28,31],"11":[3,28],"12":[20,87],"13":[107,102],"14":[5,15],"15":[20,20],"16":[1,86],"17":[87,4,4],"18":[1,0],"19":[1,0],"20":[35,51],"21":[86,83],"22":[83,78],"23":[57,11],"24":[10,47],"25":[13,50],"26":[2,11],"27":[12,38],"28":[6,27],"29":[5,7],"30":[4,7],"31":[2,2],"32":[7,0],"33":[0,7],"34":[1,6],"35":[2,8],"36":[0,2],"37":[2,17],"38":[2,0],"39":[17,0],"40":[0,17],"41":[17,17],"42":[0,19],"43":[19,19],"44":[0,19],"45":[19,0],"46":[1,18],"47":[18,17],"48":[18,16],"49":[18,0],"50":[1,0],"51":[0,18],"52":[18,7],"53":[16,2],"54":[2,16],"55":[1,0],"56":[58,17],"57":[13,54],"58":[67,27],"59":[12,5],"60":[1,19],"61":[4,1],"62":[2,2],"63":[1,0],"64":[4,2],"65":[1,3],"66":[1,0],"67":[1,0],"68":[1,1],"69":[0,0],"70":[0,0]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"ca551a1dc34d92deb40238f53641290ebdb2f54c","contentHash":"d1bdfdafd4523b5b2599e44d884f4acc5d1a94d46dddd0e664e049adb1f3b755"}} |
| {"uuid":"41351e96-1866-4198-b6a7-c4cb97a04f3d","parent":null,"pid":18944,"argv":["/home/alexisjacomy/n/bin/node","/home/alexisjacomy/modules/typology/node_modules/.bin/mocha"],"execArgv":[],"cwd":"/home/alexisjacomy/modules/typology","time":1572280379853,"ppid":18937,"root":"1ea4373f-fdae-4303-80b4-86a5a35da334","coverageFilename":"/home/alexisjacomy/modules/typology/.nyc_output/41351e96-1866-4198-b6a7-c4cb97a04f3d.json","files":["/home/alexisjacomy/modules/typology/typology.js"]} |
| {"processes":{"41351e96-1866-4198-b6a7-c4cb97a04f3d":{"parent":null,"children":[]}},"files":{"/home/alexisjacomy/modules/typology/typology.js":["41351e96-1866-4198-b6a7-c4cb97a04f3d"]},"externalIds":{}} |
-510
| const number = 30; | ||
| const typologies = { | ||
| original: require("./typology.js") | ||
| }; | ||
| if (process.argv.length < 3) { | ||
| console.log("Usage: node benchmark.js path/to/original/typology.js"); | ||
| process.exit(1); | ||
| } else typologies.modified = require("./" + process.argv[2]); | ||
| /* | ||
| Keys of a sample : | ||
| - title to display in console | ||
| - types to test isValid(type) | ||
| /!\ A sample needs at least a noError type to use check() function | ||
| - implementations to test check(implementation, type) | ||
| */ | ||
| const samples = [ | ||
| { | ||
| title: "Deep object with a string at the end", | ||
| types: { | ||
| noError: { | ||
| trap: "function", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"string"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorBeginning: { | ||
| trap: "funchion", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"string"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorEnd: { | ||
| trap: "function", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"chring"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| } | ||
| }, | ||
| implementations: { | ||
| noError: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorBeginning: { | ||
| trap: "function() { return true; }", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorEnd: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat("564") | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| unexpectedKey: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ), | ||
| unexpected: "efzef" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| title: "Deep object with a string at all level", | ||
| types: { | ||
| noError: { | ||
| trap: "function", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "string", "key":') | ||
| .concat('"string"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorBeginning: { | ||
| trap: "funchion", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "string", "key":') | ||
| .concat('"string"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorEnd: { | ||
| trap: "function", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "string", "key":') | ||
| .concat('"chring"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| } | ||
| }, | ||
| implementations: { | ||
| noError: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "ezegze", "key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorBeginning: { | ||
| trap: "function() { return true; }", | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "ezegze", "key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| errorEnd: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "ezegze", "key":') | ||
| .concat("564") | ||
| .concat(new Array(number).join("}")) | ||
| ) | ||
| }, | ||
| unexpectedKey: { | ||
| trap: function() { | ||
| return true; | ||
| }, | ||
| key: JSON.parse( | ||
| new Array(number) | ||
| .join('{"type": "ezegze", "key":') | ||
| .concat('"kzjhfaz"') | ||
| .concat(new Array(number).join("}")) | ||
| ), | ||
| unexpected: "efzef" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| title: "Large object of strings", | ||
| types: { | ||
| noError: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = "string"), a; | ||
| }, {}), | ||
| errorBeginning: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce( | ||
| function(a, b, i) { | ||
| return (a["key" + (i + 1)] = "string"), a; | ||
| }, | ||
| { key0: "chring" } | ||
| ), | ||
| errorEnd: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = i === number - 1 ? "chring" : "string"), a; | ||
| }, {}) | ||
| }, | ||
| implementations: { | ||
| noError: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = "zsegreh"), a; | ||
| }, {}), | ||
| errorBeginning: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce( | ||
| function(a, b, i) { | ||
| return (a["key" + (i + 1)] = "efzegzg"), a; | ||
| }, | ||
| { key0: /efzefze/ } | ||
| ), | ||
| errorEnd: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = i === number - 1 ? /zegzeg/ : "zegezgez"), a; | ||
| }, {}), | ||
| unexpectedKey: new Array(number + 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = "zsegreh"), a; | ||
| }, {}) | ||
| } | ||
| }, | ||
| { | ||
| title: "Large object of customs", | ||
| types: { | ||
| noError: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = "custom"), a; | ||
| }, {}), | ||
| errorBeginning: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce( | ||
| function(a, b, i) { | ||
| return (a["key" + (i + 1)] = "custom"), a; | ||
| }, | ||
| { key0: "funchion" } | ||
| ), | ||
| errorEnd: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = i === number - 1 ? "funchion" : "custom"), a; | ||
| }, {}) | ||
| }, | ||
| implementations: { | ||
| noError: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = { string: "oihzaf", regexp: /efzezf/ }), a; | ||
| }, {}), | ||
| errorBeginning: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce( | ||
| function(a, b, i) { | ||
| return ( | ||
| (a["key" + (i + 1)] = { string: "oihzaf", regexp: /efzezf/ }), a | ||
| ); | ||
| }, | ||
| { key0: { string: /oihzaf/, regexp: "efzezf" } } | ||
| ), | ||
| errorEnd: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return ( | ||
| (a["key" + i] = | ||
| i === number - 1 | ||
| ? { string: /oihzaf/, regexp: "efzezf" } | ||
| : { string: "oihzaf", regexp: /efzezf/ }), | ||
| a | ||
| ); | ||
| }, {}), | ||
| unexpectedKey: new Array(number + 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .reduce(function(a, b, i) { | ||
| return (a["key" + i] = { string: "oihzaf", regexp: /efzezf/ }), a; | ||
| }, {}) | ||
| } | ||
| }, | ||
| { | ||
| title: "Array of strings", | ||
| types: { | ||
| noError: ["string"], | ||
| error: ["chring"] | ||
| }, | ||
| implementations: { | ||
| noError: new Array(number + 1) | ||
| .join("string,") | ||
| .split(",") | ||
| .slice(0, number), | ||
| errorBeginning: [/regexp/].concat( | ||
| new Array(number) | ||
| .join("string,") | ||
| .split(",") | ||
| .slice(0, number - 1) | ||
| ), | ||
| errorEnd: new Array(number) | ||
| .join("string,") | ||
| .split(",") | ||
| .slice(0, number - 1) | ||
| .concat([/regexp/]) | ||
| } | ||
| }, | ||
| { | ||
| title: "Array of customs", | ||
| types: { | ||
| noError: ["custom"] | ||
| }, | ||
| implementations: { | ||
| noError: new Array(number) | ||
| .join("a,") | ||
| .split(",") | ||
| .map(function(a) { | ||
| return { string: "oihzaf", regexp: /efzezf/ }; | ||
| }), | ||
| errorBeginning: [{ string: /oihzaf/, regexp: "efzezf" }].concat( | ||
| new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .map(function(a) { | ||
| return { string: "oihzaf", regexp: /efzezf/ }; | ||
| }) | ||
| ), | ||
| errorEnd: new Array(number - 1) | ||
| .join("a,") | ||
| .split(",") | ||
| .map(function(a) { | ||
| return { string: "oihzaf", regexp: /efzezf/ }; | ||
| }) | ||
| .concat([{ string: /oihzaf/, regexp: "efzezf" }]) | ||
| } | ||
| }, | ||
| { | ||
| title: "Array of custom functions", | ||
| types: { | ||
| noError: ["customFunction"] | ||
| }, | ||
| implementations: { | ||
| noError: new Array(number + 1) | ||
| .join("42,") | ||
| .split(",") | ||
| .slice(0, number), | ||
| errorBeginning: [/regexp/].concat( | ||
| new Array(number) | ||
| .join("42,") | ||
| .split(",") | ||
| .slice(0, number - 1) | ||
| ), | ||
| errorEnd: new Array(number) | ||
| .join("42,") | ||
| .split(",") | ||
| .slice(0, number - 1) | ||
| .concat([/regexp/]) | ||
| } | ||
| } | ||
| ]; | ||
| // Adding the custom type to the typologies | ||
| (function() { | ||
| var keys = Object.keys(typologies), | ||
| i, | ||
| l; | ||
| for (i = 0, l = keys.length; i < l; i++) { | ||
| typologies[keys[i]].add("custom", { | ||
| string: "string", | ||
| regexp: "regexp" | ||
| }); | ||
| typologies[keys[i]].add("customFunction", function(v) { | ||
| return this.check(v, "string") && this.check(+v, "number"); | ||
| }); | ||
| } | ||
| })(); | ||
| function goValid() { | ||
| var sampleKeys, | ||
| i, | ||
| k, | ||
| times = {}, | ||
| start; | ||
| console.log("\n\n| Test isValid() | Modified | Original | Ratio |"); | ||
| console.log( | ||
| "| :------------- | :-------------: | :-------------: | :-------------: |" | ||
| ); | ||
| samples.forEach(function(sample) { | ||
| console.log("| **" + sample.title + "** ||||"); | ||
| sampleKeys = Object.keys(sample.types); | ||
| for (k = 0; k < sampleKeys.length; k++) { | ||
| // 1st loop to avoid cache bias | ||
| for (i = 0; i < 500; i++) { | ||
| typologies.modified.isValid(sample.types[sampleKeys[k]]); | ||
| typologies.original.isValid(sample.types[sampleKeys[k]]); | ||
| } | ||
| // 2nd loop to mesure time | ||
| start = Date.now(); | ||
| for (i = 0; i < 50000; i++) | ||
| typologies.modified.isValid(sample.types[sampleKeys[k]]); | ||
| times.modified = Date.now() - start; | ||
| start = Date.now(); | ||
| for (i = 0; i < 50000; i++) | ||
| typologies.original.isValid(sample.types[sampleKeys[k]]); | ||
| times.original = Date.now() - start; | ||
| times.ratio = | ||
| Math.round(((times.modified - times.original) / times.original) * 100) / | ||
| 100; | ||
| console.log( | ||
| "| " + | ||
| sampleKeys[k] + | ||
| " | " + | ||
| times.modified + | ||
| "ms" + | ||
| " | " + | ||
| times.original + | ||
| "ms" + | ||
| " | " + | ||
| (times.ratio > 0 ? "+" + times.ratio : times.ratio) + | ||
| " |" | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
| function goCheck() { | ||
| var sampleKeys, | ||
| i, | ||
| k, | ||
| times = {}, | ||
| start; | ||
| console.log("\n\n| Test check() | Modified | Original | Ratio |"); | ||
| console.log( | ||
| "| :------------- | :-------------: | :-------------: | :-------------: |" | ||
| ); | ||
| samples.forEach(function(sample) { | ||
| console.log("| **" + sample.title + "** ||||"); | ||
| sampleKeys = Object.keys(sample.implementations); | ||
| for (k = 0; k < sampleKeys.length; k++) { | ||
| // 1st loop to avoid cache bias | ||
| for (i = 0; i < 500; i++) { | ||
| typologies.modified.check( | ||
| sample.implementations[sampleKeys[k]], | ||
| sample.types.noError | ||
| ); | ||
| typologies.original.check( | ||
| sample.implementations[sampleKeys[k]], | ||
| sample.types.noError | ||
| ); | ||
| } | ||
| // 2nd loop to mesure time | ||
| start = Date.now(); | ||
| for (i = 0; i < 50000; i++) | ||
| typologies.modified.check( | ||
| sample.implementations[sampleKeys[k]], | ||
| sample.types.noError | ||
| ); | ||
| times.modified = Date.now() - start; | ||
| start = Date.now(); | ||
| for (i = 0; i < 50000; i++) | ||
| typologies.original.check( | ||
| sample.implementations[sampleKeys[k]], | ||
| sample.types.noError | ||
| ); | ||
| times.original = Date.now() - start; | ||
| times.ratio = | ||
| Math.round(((times.modified - times.original) / times.original) * 100) / | ||
| 100; | ||
| console.log( | ||
| "| " + | ||
| sampleKeys[k] + | ||
| " | " + | ||
| times.modified + | ||
| "ms" + | ||
| " | " + | ||
| times.original + | ||
| "ms" + | ||
| " | " + | ||
| (times.ratio > 0 ? "+" + times.ratio : times.ratio) + | ||
| " |" | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
| // goValid(); | ||
| goCheck(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
-100%24896
-65.19%11
83.33%5
-37.5%589
-44.28%