JSPM

  • Created
  • Published
  • Downloads 274
  • Score
    100M100P100Q82425F
  • License MIT

A set is a collection of unique values.

Package Exports

  • extra-set

Readme

A set is a collection of unique values.

const set = require('extra-set');

var s = new Set([1, 2, 3, 4]);
set.difference(s, [1, 3]);
// Set(2) { 2, 4 }

var t = new Set([2, 3]);
set.isDisjoint(t, [4, 5]);
// true

set.symmetricDifference([1, 2, 3], [2, 3, 4]);
// Set(2) { 1, 4 }

reference

Method Action
is Checks if value is set.
compare Compares two sets.
isEqual Checks if two sets are equal.
some Checks if any value satisfies a test.
every Checks if all values satisfy a test.
map Updates values based on map function.
reduce Reduces values to a single value.
filter Keeps values which pass a test.
filter$ Keeps values which satisfy a test.
find Finds values passing the test.
pop Removes a value from a set.
pop$ Removes a value from a set.
isSubset Checks if set has a subset.
isSuperset Checks if set is contained in all lists.
isDisjoint Checks if sets have no common values.
subsets Lists all subsets of a set.
union Gives values present in any set.
union$ Gives a set with values from all lists.
intersection Gives values present in both sets.
intersection$ Gives a set with values in all lists.
difference Gives values of set not present in another.
difference$ Gives values of set not present in another.
symmetricDifference Gives values not present in both sets.

nodef

Browserified, minified version of this package is extra-set.min.