Tiny utility to create unions and de-duplicated lists.
Example:
var uniqs = ; var foo = foo: 23 ;var list = 3 2 2 1 foo foo; ;// => [3, 2, 1, { foo: 23 }]
You can pass multiple lists to create a union:
;// => [2, 1, 3, 4]
Passing individual items works too:
;// => [3, 2, 1]
Summary
- Uniqueness is defined based on strict object equality.
- The lists do not need to be sorted.
- The resulting array contains the items in the order of their first appearance.
About
This package has been written to accompany utilities like flatten as alternative to full-blown libraries like underscore or lodash.
The implementation is optimized for simplicity rather than performance and looks like this:
module { var list = Arrayprototypeconcat; return list;};
License
MIT