npm.io
1.0.4 • Published 3 years ago

extended-set

Licence
MIT
Version
1.0.4
Deps
0
Size
2 kB
Vulns
0
Weekly
0

Extended Set

Extended Set is a small package that allows you to pass in an array of values instead of calling Set.has() multiple times yourself.

Usage

Set.includes() returns true if all given values are present in the set.

import "extended-set"

const x = new Set([1, 2, 3, 4])

if(x.includes([1, 3])){ // Will return true because 1 and 3 are in the set.
	// Do something
}

Set.some() returns true if a single value is present in the set.

import "extended-set"

const x = new Set([1, 2, 3, 4])

if(x.some([6, 5, 4])) { // Will return true because 4 is in the set.
	// Do something
}

Keywords