@wordpress/is-shallow-equal
Version:
Test for shallow equality between two objects or arrays.
29 lines (28 loc) • 618 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isShallowEqualArrays;
/**
* Returns true if the two arrays are shallow equal, or false otherwise.
*
* @param a First array to compare.
* @param b Second array to compare.
*
* @return Whether the two arrays are shallow equal.
*/
function isShallowEqualArrays(a, b) {
if (a === b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (let i = 0, len = a.length; i < len; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
//# sourceMappingURL=arrays.js.map