set-component
Set container
Last updated 13 years ago by tjholowaychuk .
Original npm · Tarball · package.json
$ cnpm install set-component 
SYNC missed versions from official npm registry.

set

Generic Set container

Installation

$ component install component/set

Example

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' }]

API

Set()

Create a new Set.

Set(values)

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

Set#add(value)

Add value to the set.

Set#remove(value)

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

Set#has(value)

Check if value is present.

Set#values()

Return an array of values.

Set#size()

Return the set size.

Set#empty()

Empty the set and return the old values array.

Set#union(set)

Perform a union with set and return a new Set.

Set#intersect(set)

Perform an intersection with set and return a new Set.

License

MIT

Current Tags

  • 1.0.0                                ...           latest (13 years ago)

5 Versions

  • 1.0.0                                ...           13 years ago
  • 0.0.4                                ...           13 years ago
  • 0.0.3                                ...           14 years ago
  • 0.0.2                                ...           14 years ago
  • 0.0.1                                ...           14 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 5
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |