set-component

Set container

set

Generic Set container

$ component install component/set
var Set = require('set');
var set = new Set;
 
set.add('foo');
set.add('foo');
set.add({ some: 'object' });
set.remove('foo');
 
set.values();
// => [{ some: 'object' }] 

Create a new Set.

Create a new Set with values array. Duplicates will be removed.

Add value to the set.

Remove value from the set, returning true when present, otherwise returning false.

Check if value is present.

Return an array of values.

Return the set size.

Empty the set and return the old values array.

Perform a union with set and return a new Set.

Perform an intersection with set and return a new Set.

MIT