object-diff
Advanced tools
Comparing version 0.0.2 to 0.0.3
27
index.js
'use strict'; | ||
module.exports = diff; | ||
strict.custom = custom; | ||
function diff(){ | ||
var length = arguments.length; | ||
var ref = arguments[0]; | ||
module.exports = strict; | ||
function strict(){ | ||
return diff(null, [].slice.call(arguments, 0)); | ||
} | ||
function custom( opts ){ | ||
return diff(opts, [].slice.call(arguments, 1)); | ||
} | ||
function diff( opts, subjects ){ | ||
var length = subjects.length; | ||
var ref = subjects[0]; | ||
var diff = {}; | ||
var equal = opts && opts.equal || isStrictEqual; | ||
var c; | ||
@@ -16,3 +27,3 @@ var keys; | ||
for (var i = 1;i < length;i++) { | ||
c = arguments[i]; | ||
c = subjects[i]; | ||
keys = Object.keys(c); | ||
@@ -24,3 +35,3 @@ keysLength = keys.length; | ||
if (c[key] !== ref[key]) | ||
if (!equal(c[key], ref[key])) | ||
diff[key] = c[key]; | ||
@@ -32,1 +43,5 @@ } | ||
} | ||
function isStrictEqual( a, b ){ | ||
return a === b; | ||
} |
{ | ||
"name": "object-diff", | ||
"description": "Get the diff from objectA to objectB", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "index.js", | ||
@@ -17,4 +17,3 @@ "repository": { | ||
"devDependencies": { | ||
"tape": "^3.2.0", | ||
"extend": "^2.0.0", | ||
"tape": "^4.5.1", | ||
"testling": "^1.7.1" | ||
@@ -21,0 +20,0 @@ }, |
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
2817
2
34