2.2.10 • Published 3 years ago

@extra-lists/has-subset v2.2.10

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

Checks if lists has a subset. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath. Similar: subset, subsets, hasSubset.

This is part of package extra-lists.

lists.hasSubset(x, y, [fc], [fm]);
// x:  lists
// y:  subset?
// fc: compare function (a, b)
// fm: map function (v, k, x)
const lists = require('extra-lists');

var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 4]];
var y = [['b', 'd'], [2, 4]];
lists.hasSubset(x, y);
// true

var y = [['b', 'd'], [-2, -4]];
lists.hasSubset(x, y);
// false

lists.hasSubset(x, y, (a, b) => Math.abs(a) - Math.abs(b));
// true

lists.hasSubset(x, y, null, v => Math.abs(v));
// true

References

2.2.10

3 years ago

2.2.9

3 years ago

2.2.7

3 years ago

2.2.8

3 years ago

2.2.5

3 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.0

4 years ago

2.1.8

4 years ago