@extra-lists/is-submap.min

Checks if lists has a submap. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:] > Similar: [subobject], [subobjects], [isSubobject]. > This is part of package [extra-lists].

Usage no npm install needed!

<script type="module">
  import extraListsIsSubmapMin from 'https://cdn.skypack.dev/@extra-lists/is-submap.min';
</script>

README

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

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

This is browserified, minified version of @extra-lists/is-submap.
It is exported as global variable lists_isSubmap.
CDN: unpkg, jsDelivr.

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