consists
v2.0.0
Published
Test if arrays consist of the same members.
Downloads
23
Maintainers
Readme
Consists
Test if arrays consist of the same members. Handles:
- 2 or more arrays
- arrays with multiple equivalent values
- primitive & non-primitive array value types (uses SameValueZero for equality comparisons)
NaN
values
import consists from 'consists';
consists([1,1,2,3], [3,1,2,1], [2,1,3,1]);
// => true
consists([1,1,2,3], [3,1,2]);
// => false
const a = { a: 'a' };
const b = { b: 'b' };
const c = { c: 'c' };
const a2 = { a: 'a' };
consists([a, b, c], [c, a, b]);
// => true
consists([a, b, c], [a2, b, c]);
// => false
Installation
npm i --save consists
Usage
import consists from 'consists';
consists([1,1,2,3], [3,1,2,1], [2,1,3,1]);
// => true
Lodash mixin:
import _ from 'lodash';
import consists from 'consists';
_.mixin({consists});
_.consists([1,1,2,3], [3,1,2,1], [2,1,3,1]);
// => true
License
MIT