UNPKG

@mattseligman/lotide

Version:

Lotide is a mini clone of the Lodash Library to practice crating a personal npm package. It's like lodash, but without all that extra stuff. Just the things you need to start your project.

19 lines (15 loc) 620 B
const eqArrays = require('./eqArrays'); const eqObjects = function(object1, object2) { const sameLength = object1.length === object2.length; const sameType = typeof object1 === typeof object2; const sameKeys = eqArrays(Object.keys(object1), Object.keys(object2)); const sameValues = eqArrays(Object.values(object1), Object.values(object2)); const sameEntries = eqArrays(Object.entries(object1), Object.entries(object2)); let result = true; //basecase if (!sameLength || !sameKeys || !sameEntries || !sameValues || !sameType) { result = false; } return result; }; module.exports = eqObjects;