-
Notifications
You must be signed in to change notification settings - Fork 0
hasSubset
Subhajit Sahu edited this page Jun 28, 2020
·
11 revisions
Checks if entries has a subset. 🏃 📼 📦 🌔 📒
Alternatives: has, hasValue, hasEntry, hasSubset.
Similar: subset, subsets, hasSubset.
entries.hasSubset(x, y, [fc], [fm]);
// x: entries
// y: subset?
// fc: compare function (a, b)
// fm: map function (v, k, x)
const entries = require('extra-entries');
var x = [['a', 1], ['b', 2], ['c', 3], ['d', 4]];
var y = [['b', 2], ['d', 4]];
entries.isSubset(x, y);
// true
var y = [['b', -2], ['d', -4]];
entries.isSubset(x, y);
// false
entries.isSubset(x, y, (a, b) => Math.abs(a) - Math.abs(b));
// true
entries.isSubset(x, y, null, v => Math.abs(v));
// true