Skip to content

Commit

Permalink
docs(readme): add introduction
Browse files Browse the repository at this point in the history
  • Loading branch information
couralex committed Dec 13, 2016
1 parent dce147d commit a217c1a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# equal-array
# equal-array

equal-array compares arrays by values instead of references.

## Why ?

It is mainly useful with an es6 Map or Set, where arrays, used as keys, are compared by references. For example :
```js
const map = new Map();
map.set([1, 2 ,3], 'a');
map.set([1, 2 ,3], 'b'); // the map will consider [1, 2 ,3] as a new key
map.size(); // returns 2 - with equal-array: returns 1
map.has([1, 2, 3]); // returns false - with equal-array: returns true
```

0 comments on commit a217c1a

Please sign in to comment.