Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function length(obj) {
if (Util.isArray(obj)) {
return obj.length;
} else if (Util.isObject(obj)) {
return Object.keys(obj).length;
}
return 0;
}
shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
if (Util.isArray(objA) !== Util.isArray(objB)) {
return false;
}
if (length(objA) !== length(objB)) {
return false;
}
let ret = true;
Util.each(objA, (v, k) => {
if (!is(v, objB[k])) {
ret = false;
return ret;
}
return true;
});