UNPKG

@extra-array/is-equal

Version:

Checks if two arrays are equal.

56 lines (40 loc) 1.43 kB
Checks if two arrays are equal. [:package:](https://www.npmjs.com/package/@extra-array/is-equal) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/is-equal) [:vhs:](https://asciinema.org/a/332078) [:moon:](https://www.npmjs.com/package/@extra-array/is-equal.min) [:scroll:](https://unpkg.com/@extra-array/is-equal/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Similar: [compare], [isEqual]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.isEqual(x, y, [fc], [fm]); // x: an array // y: another array // fc: compare function (a, b) // fm: map function (v, i, x) ``` ```javascript const array = require("extra-array"); var x = [1, 2]; array.isEqual(x, [1, 2]); // true array.isEqual(x, [11, 12]); // false array.isEqual(x, [11, 12], (a, b) => (a % 10) - (b % 10)); // true array.isEqual(x, [11, 12], null, v => v % 10); // true ``` <br> <br> ## References - [Array.isEqual: sugarjs](https://sugarjs.com/docs/#/Array/isEqual) - [is-arrays-equal: @teaegg](https://www.npmjs.com/package/is-arrays-equal) - [shallow-equal: @moroshko](https://www.npmjs.com/package/shallow-equal) [compare]: https://github.com/nodef/extra-array/wiki/compare [isEqual]: https://github.com/nodef/extra-array/wiki/isEqual