Comparing version 0.2.18 to 0.2.19
{ | ||
"name": "aether", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"homepage": "https://github.com/codecombat/aether", | ||
@@ -5,0 +5,0 @@ "authors": [ |
(function() { | ||
var argsClass, arrayClass, boolClass, cloneableClasses, createAPIClone, ctorByClass, dateClass, errorClass, funcClass, numberClass, objectClass, protectionIdCounter, reFlags, regexpClass, restoreAPIClone, stringClass, _, _ref, _ref1, _ref2, | ||
var PROTECTION_VERSION, argsClass, arrayClass, boolClass, cloneableClasses, createAPIClone, ctorByClass, dateClass, errorClass, funcClass, numberClass, objectClass, protectionIdCounter, reFlags, regexpClass, restoreAPIClone, stringClass, _, _ref, _ref1, _ref2, | ||
__hasProp = {}.hasOwnProperty; | ||
@@ -37,6 +37,8 @@ | ||
module.exports.protectionVersion = PROTECTION_VERSION = 0; | ||
reFlags = /\w*$/; | ||
module.exports.createAPIClone = createAPIClone = function(aether, value) { | ||
var className, ctor, i, id, isArr, k, prop, result, v, _fn, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref3, _ref4, _ref5, _ref6, _ref7; | ||
var className, clone, ctor, i, id, isArr, k, prop, result, v, _fn, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref3, _ref4, _ref5, _ref6, _ref7; | ||
if (!_.isObject(value)) { | ||
@@ -62,12 +64,21 @@ return value; | ||
} | ||
if (value.__aetherID != null) { | ||
id = value.__aetherID; | ||
if ((result = aether.protectAPIValuesToClones[id]) != null) { | ||
return result; | ||
if (PROTECTION_VERSION === 0) { | ||
if (clone = value.__aetherAPIClone) { | ||
return clone; | ||
} | ||
if (value.__aetherAPIValue) { | ||
return value; | ||
} | ||
} else { | ||
id = protectionIdCounter++; | ||
Object.defineProperty(value, '__aetherID', { | ||
value: id | ||
}); | ||
if (value.__aetherID != null) { | ||
id = value.__aetherID; | ||
if ((result = aether.protectAPIValuesToClones[id]) != null) { | ||
return result; | ||
} | ||
} else { | ||
id = protectionIdCounter++; | ||
Object.defineProperty(value, '__aetherID', { | ||
value: id | ||
}); | ||
} | ||
} | ||
@@ -85,7 +96,18 @@ if (isArr = _.isArray(value)) { | ||
} | ||
Object.defineProperty(result, '__aetherID', { | ||
value: id | ||
}); | ||
aether.protectAPIValuesToClones[id] = result; | ||
aether.protectAPIClonesToValues[id] = value; | ||
if (PROTECTION_VERSION === 0) { | ||
Object.defineProperty(value, "__aetherAPIClone", { | ||
value: result, | ||
writable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(result, "__aetherAPIValue", { | ||
value: value | ||
}); | ||
} else { | ||
Object.defineProperty(result, '__aetherID', { | ||
value: id | ||
}); | ||
aether.protectAPIValuesToClones[id] = result; | ||
aether.protectAPIClonesToValues[id] = value; | ||
} | ||
if (isArr) { | ||
@@ -152,3 +174,3 @@ for (i = _i = 0, _len = value.length; _i < _len; i = ++_i) { | ||
module.exports.restoreAPIClone = restoreAPIClone = function(aether, value, depth) { | ||
var className, isArr, k, result, source, v; | ||
var className, isArr, k, result, source, v, _ref3; | ||
if (depth == null) { | ||
@@ -167,4 +189,13 @@ depth = 0; | ||
} | ||
if ((source = aether.protectAPIClonesToValues[value.__aetherID]) != null) { | ||
return source; | ||
if (PROTECTION_VERSION === 0) { | ||
if (source = value.__aetherAPIValue) { | ||
return source; | ||
} | ||
if (source = (_ref3 = value.__aetherAPIClone) != null ? _ref3.__aetherAPIValue : void 0) { | ||
return source; | ||
} | ||
} else { | ||
if ((source = aether.protectAPIClonesToValues[value.__aetherID]) != null) { | ||
return source; | ||
} | ||
} | ||
@@ -171,0 +202,0 @@ if (depth > 1) { |
{ | ||
"name": "aether", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"description": "Analyzes, instruments, and transpiles JS to help beginners.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156202
2677