@a11d/equals
Version:
A value equality utility library.
19 lines (18 loc) • 430 B
JavaScript
import { equals } from './symbol.js';
Array.prototype[equals] = function (other) {
if (this === other) {
return true;
}
if (!(other instanceof Array)) {
return false;
}
if (this.length !== other.length) {
return false;
}
for (const index in this) {
if (Object[equals](this[index], other[index]) === false) {
return false;
}
}
return true;
};