get-object-with-attributes-that-changed
Advanced tools
Comparing version 1.0.0 to 1.0.1
14
index.js
const assert = require('assert').strict; | ||
module.exports = (object1, object2) => { | ||
// If either object1 or object2 is object and other is array, throw eeror | ||
if (object1 === null) { | ||
throw 'first object cannot be null'; | ||
} | ||
if (object2 === null) { | ||
throw 'second object cannot be null'; | ||
} | ||
if (typeof object1 === 'undefined') { | ||
throw 'first object cannot be undefined'; | ||
} | ||
if (typeof object2 === 'undefined') { | ||
throw 'second object cannot be undefined'; | ||
} | ||
// If either object1 or object2 is object and other is array, throw error | ||
if (Array.isArray(object1) && !Array.isArray(object2)) { | ||
@@ -5,0 +17,0 @@ throw 'Comparing incompatible types'; |
{ | ||
"name": "get-object-with-attributes-that-changed", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "ava" | ||
}, | ||
"keywords": [], | ||
"author": "Fabio Espinosa", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"ava": "^1.2.0" | ||
}, | ||
"dependencies": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/fabioespinosa/get-object-with-attributes-that-changed.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fabioespinosa/get-object-with-attributes-that-changed/issues" | ||
}, | ||
"homepage": "https://github.com/fabioespinosa/get-object-with-attributes-that-changed#readme", | ||
"description": "" | ||
"name": "get-object-with-attributes-that-changed", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "ava" | ||
}, | ||
"keywords": [], | ||
"author": "Fabio Espinosa", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"ava": "^1.2.0" | ||
}, | ||
"dependencies": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/fabioespinosa/get-object-with-attributes-that-changed.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fabioespinosa/get-object-with-attributes-that-changed/issues" | ||
}, | ||
"homepage": "https://github.com/fabioespinosa/get-object-with-attributes-that-changed#readme", | ||
"description": "" | ||
} |
8510
5
211