UNPKG

@up-group/react-controls

Version:

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get

39 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function is(x, y) { if (x === y) { return x !== 0 || y !== 0 || 1 / x === 1 / y; } else { return x !== x && y !== y; } } function shallowEqual(objA, objB) { if (is(objA, objB)) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } for (var i = 0; i < keysA.length; i++) { if (objA[keysA[i]] && objA[keysA[i]].constructor === Array) { for (var j = 0; j < objA[keysA[i]].lenght; j++) { if (shallowEqual(objA[keysA[i]][j], objA[keysB[i]][j]) === false) { return false; } } } else if (!objB.hasOwnProperty(keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { return false; } } return true; } exports.default = shallowEqual; ; //# sourceMappingURL=shallowEqual.js.map