2.1.0 • Published 4 years ago

@extra-lists/is-submap v2.1.0

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

Checks if lists has a submap. :running: :package: :ledger:

Similar: subobject, subobjects, isSubobject. This is part of package extra-lists.

lists.isSubmap(x, y, [fc], [fm]);
// x:  lists
// y:  submap?
// 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.isSubmap(x, y);
// true

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

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

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

references

2.1.0

4 years ago

2.0.91

4 years ago

2.0.89

4 years ago

2.0.90

4 years ago

2.0.88

4 years ago