Comparing version 2.0.1 to 2.0.2
@@ -23,3 +23,3 @@ /* | ||
/* | ||
* Version 2.0.0 - ac21ff4 | ||
* Version 2.0.2 - e9f61e5 | ||
*/ | ||
@@ -352,3 +352,3 @@ | ||
},{"../src/adapters/base":6,"../src/utils":8}],2:[function(require,module,exports){ | ||
},{"../src/adapters/base":5,"../src/utils":7}],2:[function(require,module,exports){ | ||
/* | ||
@@ -451,131 +451,5 @@ * | ||
},{"../src/KintoBase":5,"../src/adapters/base":6,"../src/utils":8,"./FirefoxStorage":1}],3:[function(require,module,exports){ | ||
},{"../src/KintoBase":4,"../src/adapters/base":5,"../src/utils":7,"./FirefoxStorage":1}],3:[function(require,module,exports){ | ||
},{}],4:[function(require,module,exports){ | ||
'use strict' | ||
function isArguments (object) { | ||
return Object.prototype.toString.call(object) === '[object Arguments]' | ||
} | ||
function deeper (a, b) { | ||
return deeper_(a, b, [], []) | ||
} | ||
module.exports = deeper | ||
try { | ||
deeper.fastEqual = require('buffertools').equals | ||
} catch (e) { | ||
// whoops, nobody told buffertools it wasn't installed | ||
} | ||
/** | ||
* This is a Node-specific version of a structural equality test, modeled on | ||
* bits and pieces of loads of other implementations of this algorithm, most | ||
* notably the one in the Node.js source and the Underscore library. It doesn't | ||
* throw and handles cycles. | ||
* | ||
* Everybody who writes one of these functions puts the documentation | ||
* inline, which makes it incredibly hard to follow. Here's what this version | ||
* of the algorithm does, in order: | ||
* | ||
* 1. `===` only tests objects and functions by reference. `null` is an object. | ||
* Any pairs of identical entities failing this test are therefore objects | ||
* (including `null`), which need to be recursed into and compared attribute by | ||
* attribute. | ||
* 2. Since the only entities to get to this test must be objects, if `a` or `b` | ||
* is not an object, they're clearly not the same. All unfiltered `a` and `b` | ||
* getting past this are objects (including `null`). | ||
* 3. `null` is an object, but `null === null.` All unfiltered `a` and `b` are | ||
* non-null `Objects`. | ||
* 4. Buffers need to be special-cased because they live partially on the wrong | ||
* side of the C++ / JavaScript barrier. Still, calling this on structures | ||
* that can contain Buffers is a bad idea, because they can contain | ||
* multiple megabytes of data and comparing them byte-by-byte is hella | ||
* expensive. | ||
* 5. It's much faster to compare dates by numeric value (`.getTime()`) than by | ||
* lexical value. | ||
* 6. Compare `RegExps` by their components, not the objects themselves. | ||
* 7. Treat argumens objects like arrays. The parts of an arguments list most | ||
* people care about are the arguments themselves, not `callee`, which you | ||
* shouldn't be looking at anyway. | ||
* 8. Objects are more complex: | ||
* 1. Ensure that `a` and `b` are on the same constructor chain. | ||
* 2. Ensure that `a` and `b` have the same number of own properties (which is | ||
* what `Object.keys()` returns). | ||
* 3. Ensure that cyclical references don't blow up the stack. | ||
* 4. Ensure that all the key names match (faster). | ||
* 5. Ensure that all of the associated values match, recursively (slower). | ||
* | ||
* (somewhat untested) assumptions: | ||
* | ||
* - Functions are only considered identical if they unify to the same | ||
* reference. To anything else is to invite the wrath of the halting problem. | ||
* - V8 is smart enough to optimize treating an Array like any other kind of | ||
* object. | ||
* - Users of this function are cool with mutually recursive data structures | ||
* that are otherwise identical being treated as the same. | ||
*/ | ||
function deeper_ (a, b, ca, cb) { | ||
if (a === b) { | ||
return true | ||
} else if (typeof a !== 'object' || typeof b !== 'object') { | ||
return false | ||
} else if (a === null || b === null) { | ||
return false | ||
} else if (Buffer.isBuffer(a) && Buffer.isBuffer(b)) { | ||
if (a.equals) { | ||
return a.equals(b) | ||
} else if (deeper.fastEqual) { | ||
return deeper.fastEqual.call(a, b) | ||
} else { | ||
if (a.length !== b.length) return false | ||
for (var i = 0; i < a.length; i++) if (a[i] !== b[i]) return false | ||
return true | ||
} | ||
} else if (a instanceof Date && b instanceof Date) { | ||
return a.getTime() === b.getTime() | ||
} else if (a instanceof RegExp && b instanceof RegExp) { | ||
return a.source === b.source && | ||
a.global === b.global && | ||
a.multiline === b.multiline && | ||
a.lastIndex === b.lastIndex && | ||
a.ignoreCase === b.ignoreCase | ||
} else if (isArguments(a) || isArguments(b)) { | ||
if (!(isArguments(a) && isArguments(b))) return false | ||
var slice = Array.prototype.slice | ||
return deeper_(slice.call(a), slice.call(b), ca, cb) | ||
} else { | ||
if (a.constructor !== b.constructor) return false | ||
var ka = Object.keys(a) | ||
var kb = Object.keys(b) | ||
// don't bother with stack acrobatics if there's nothing there | ||
if (ka.length === 0 && kb.length === 0) return true | ||
if (ka.length !== kb.length) return false | ||
var cal = ca.length | ||
while (cal--) if (ca[cal] === a) return cb[cal] === b | ||
ca.push(a); cb.push(b) | ||
ka.sort(); kb.sort() | ||
for (var j = ka.length - 1; j >= 0; j--) if (ka[j] !== kb[j]) return false | ||
var key | ||
for (var k = ka.length - 1; k >= 0; k--) { | ||
key = ka[k] | ||
if (!deeper_(a[key], b[key], ca, cb)) return false | ||
} | ||
ca.pop(); cb.pop() | ||
return true | ||
} | ||
} | ||
},{"buffertools":3}],5:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -691,3 +565,3 @@ | ||
},{"./adapters/base":6,"./collection":7}],6:[function(require,module,exports){ | ||
},{"./adapters/base":5,"./collection":6}],5:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -802,3 +676,3 @@ | ||
},{}],7:[function(require,module,exports){ | ||
},{}],6:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -820,6 +694,2 @@ | ||
var _deeper = require("deeper"); | ||
var _deeper2 = _interopRequireDefault(_deeper); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -955,3 +825,3 @@ | ||
} | ||
const identical = (0, _deeper2.default)(cleanRecord(local), cleanRecord(remote)); | ||
const identical = (0, _utils.deepEqual)(cleanRecord(local), cleanRecord(remote)); | ||
if (local._status !== "synced") { | ||
@@ -1793,3 +1663,3 @@ // Locally deleted, unsynced: scheduled for remote deletion. | ||
},{"./adapters/base":6,"./utils":8,"deeper":4,"uuid":3}],8:[function(require,module,exports){ | ||
},{"./adapters/base":5,"./utils":7,"uuid":3}],7:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -1806,2 +1676,3 @@ | ||
exports.pFinally = pFinally; | ||
exports.deepEqual = deepEqual; | ||
const RE_UUID = exports.RE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; | ||
@@ -1916,3 +1787,32 @@ | ||
/** | ||
* Simple deep object comparison function. This only supports comparison of | ||
* serializable JavaScript objects. | ||
* | ||
* @param {Object} a The source object. | ||
* @param {Object} b The compared object. | ||
* @return {Boolean} | ||
*/ | ||
function deepEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
if (typeof a !== typeof b) { | ||
return false; | ||
} | ||
if (!(a instanceof Object) || !(b instanceof Object)) { | ||
return false; | ||
} | ||
if (Object.keys(a).length !== Object.keys(b).length) { | ||
return false; | ||
} | ||
for (let k in a) { | ||
if (!deepEqual(a[k], b[k])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
},{}]},{},[2])(2) | ||
}); |
@@ -24,6 +24,2 @@ "use strict"; | ||
var _deeper = require("deeper"); | ||
var _deeper2 = _interopRequireDefault(_deeper); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -180,3 +176,3 @@ | ||
} | ||
var identical = (0, _deeper2.default)(cleanRecord(local), cleanRecord(remote)); | ||
var identical = (0, _utils.deepEqual)(cleanRecord(local), cleanRecord(remote)); | ||
if (local._status !== "synced") { | ||
@@ -183,0 +179,0 @@ // Locally deleted, unsynced: scheduled for remote deletion. |
@@ -6,2 +6,5 @@ "use strict"; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
exports.sortObjects = sortObjects; | ||
@@ -13,2 +16,3 @@ exports.filterObjects = filterObjects; | ||
exports.pFinally = pFinally; | ||
exports.deepEqual = deepEqual; | ||
var RE_UUID = exports.RE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; | ||
@@ -129,2 +133,31 @@ | ||
}); | ||
} | ||
/** | ||
* Simple deep object comparison function. This only supports comparison of | ||
* serializable JavaScript objects. | ||
* | ||
* @param {Object} a The source object. | ||
* @param {Object} b The compared object. | ||
* @return {Boolean} | ||
*/ | ||
function deepEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
if ((typeof a === "undefined" ? "undefined" : _typeof(a)) !== (typeof b === "undefined" ? "undefined" : _typeof(b))) { | ||
return false; | ||
} | ||
if (!(a instanceof Object) || !(b instanceof Object)) { | ||
return false; | ||
} | ||
if (Object.keys(a).length !== Object.keys(b).length) { | ||
return false; | ||
} | ||
for (var k in a) { | ||
if (!deepEqual(a[k], b[k])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} |
{ | ||
"name": "kinto", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "JavaScript client for Kinto.", | ||
@@ -11,6 +11,6 @@ "main": "lib/index.js", | ||
"dist": "mkdir -p dist && rm -f dist/*.* && npm run dist-dev && npm run dist-prod && npm run dist-noshim && npm run dist-fx", | ||
"dist-dev": "browserify -s Kinto -d --ignore buffertools -e src/index.js -o dist/kinto-$npm_package_version.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-noshim": "browserify -s Kinto -g uglifyify --ignore buffertools --ignore isomorphic-fetch --ignore babel-polyfill -e src/index.js -o dist/kinto-$npm_package_version.noshim.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-prod": "browserify -s Kinto -g uglifyify --ignore buffertools -e src/index.js -o dist/kinto-$npm_package_version.min.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-fx": "BABEL_ENV=firefox browserify -s loadKinto --bare --ignore uuid --ignore buffertools --ignore kinto-client --ignore isomorphic-fetch -e fx-src/index.js -o temp.jsm -t [ babelify --sourceMapRelative . ] && mkdir -p dist && cp fx-src/jsm_prefix.js dist/moz-kinto-offline-client.js && echo \"\n/*\n * Version $npm_package_version - $(git rev-parse --short HEAD)\n */\n\" >> dist/moz-kinto-offline-client.js && cat temp.jsm >> dist/moz-kinto-offline-client.js && rm temp.jsm", | ||
"dist-dev": "browserify --ignore process -s Kinto -d -e src/index.js -o dist/kinto-$npm_package_version.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-noshim": "browserify --ignore process -s Kinto -g uglifyify --ignore isomorphic-fetch --ignore babel-polyfill -e src/index.js -o dist/kinto-$npm_package_version.noshim.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-prod": "browserify --ignore process -s Kinto -g uglifyify -e src/index.js -o dist/kinto-$npm_package_version.min.js -t [ babelify --sourceMapRelative . ]", | ||
"dist-fx": "BABEL_ENV=firefox browserify -s loadKinto --bare --ignore uuid --ignore kinto-client --ignore isomorphic-fetch -e fx-src/index.js -o temp.jsm -t [ babelify --sourceMapRelative . ] && mkdir -p dist && cp fx-src/jsm_prefix.js dist/moz-kinto-offline-client.js && echo \"\n/*\n * Version $npm_package_version - $(git rev-parse --short HEAD)\n */\n\" >> dist/moz-kinto-offline-client.js && cat temp.jsm >> dist/moz-kinto-offline-client.js && rm temp.jsm", | ||
"compute-sri": "cd dist; for file in $(ls kinto-*.js); do printf \"| %-23s | %-64s |\\n\" ${file} $(echo -n 'sha384-' && cat ${file} | openssl dgst -sha384 -binary | openssl enc -base64); done", | ||
@@ -72,3 +72,2 @@ "publish-demo": "npm run dist-prod && cp dist/kinto-$npm_package_version.js demo/kinto.js && gh-pages -d demo", | ||
"btoa": "^1.1.2", | ||
"deeper": "^2.1.0", | ||
"fake-indexeddb": "1.0.6", | ||
@@ -75,0 +74,0 @@ "kinto-client": "^0.6.0", |
Sorry, the diff of this file is not supported yet
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
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2894758
5
45
32728
6
7
- Removeddeeper@^2.1.0
- Removeddeeper@2.1.0(transitive)