2.2.11 • Published 4 years ago

extra-set.min v2.2.11

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

A set is a collection of unique values. :package: NPM, :smiley_cat: GitHub, :running: RunKit, :vhs: Asciinema, :moon: Minified, :scroll: Files, :newspaper: JSDoc, :blue_book: Wiki.

Methods look like:

  • concat(): doesn't modify the map itself (pure).
  • concat$(): modifies the map itself (update).

Methods as separate packages:

Stability: Experimental.

This is browserified, minified version of extra-set. It is exported as global variable set. CDN: unpkg, jsDelivr.

const set = require("extra-set");
// import * as set from "extra-set";
// import * as set from "https://unpkg.com/extra-set@2.1.60/index.mjs"; (deno)

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

var x = new Set([1, 2, 3]);
var y = new Set([3, 4]);
set.isDisjoint(x, y);
// false

var x = new Set([1, 2, 3, 4]);
var y = new Set([3, 4, 5, 6]);
set.symmetricDifference(x, y);
// Set(4) { 1, 2, 5, 6 }

var x = new Set([1, 2, 3]);
[...set.subsets(x)];
// [
//   Set(0) {},
//   Set(1) { 1 },
//   Set(1) { 2 },
//   Set(2) { 1, 2 },
//   Set(1) { 3 },
//   Set(2) { 1, 3 },
//   Set(2) { 2, 3 },
//   Set(3) { 1, 2, 3 }
// ]

Index

MethodAction
isChecks if value is set.
addAdds value to set.
removeDeletes a value.
sizeGets size of set.
headGets first value.
takeKeeps first n values only.
shiftRemoves first value.
fromCreates a set from values.
concatAppends values from sets.
flatFlattens nested set to given depth.
chunkBreaks set into chunks of given size.
filterAtGets set with given values.
mapUpdates values based on map function.
filterKeeps values which pass a test.
reduceReduces values to a single value.
rangeFinds smallest and largest entries.
countCounts values which satisfy a test.
partitionSegregates values by test result.
cartesianProductLists cartesian product of sets.
someChecks if any value satisfies a test.
unionGives values present in any set.
intersectionGives values present in both sets.
differenceGives values of set not present in others.
symmetricDifferenceGives values not present in both sets.
isDisjointChecks if sets have no common values.
valuePicks an arbitrary value.
entryPicks an arbitrary entry.
subsetPicks an arbitrary subset.
isEmptyChecks if set is empty.
isEqualChecks if two sets are equal.
compareCompares two sets.
findFinds a value passing s test.
scanWhileFinds first value not passing a test.

npm.io

2.2.11

4 years ago

2.2.10

4 years ago

2.2.9

4 years ago

2.2.8

4 years ago

2.2.7

4 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.1

5 years ago

2.1.62

5 years ago

2.1.60

5 years ago

2.1.58

5 years ago

2.1.56

5 years ago

2.1.54

5 years ago

2.1.53

5 years ago

2.1.51

5 years ago

2.1.49

5 years ago

2.1.46

5 years ago

2.1.50

5 years ago

2.1.44

5 years ago

2.1.42

5 years ago

2.1.2

5 years ago

2.0.15

5 years ago

2.1.1

5 years ago

2.0.16

5 years ago

2.1.0

5 years ago

2.0.17

5 years ago

2.0.18

5 years ago

2.0.14

5 years ago

2.0.13

5 years ago

2.0.11

5 years ago

2.0.12

5 years ago

2.0.10

5 years ago

2.0.7

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago