2.1.43 • Published 4 years ago

@extra-map/is-subset v2.1.43

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

Checks if map has a subset. :running: :package: :ledger:

Similar: subset, subsets, isSubset. This is part of package extra-map.

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

var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4]]);
var y = new Map([['b', 2], ['d', 4]]);
map.isSubset(x, y);
// true

var y = new Map([['b', -2], ['d', -4]]);
map.isSubset(x, y);
// false

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

map.isSubset(x, y, null, v => Math.abs(v));
// true

references

2.1.38

4 years ago

2.1.39

4 years ago

2.1.36

4 years ago

2.1.37

4 years ago

2.1.35

4 years ago

2.1.43

4 years ago

2.1.41

4 years ago

2.1.42

4 years ago

2.1.40

4 years ago

2.1.34

4 years ago

2.1.33

4 years ago

2.1.32

4 years ago