There was an error while loading. Please reload this page.
Check if object has a subset.
Similar: has, hasValue, hasEntry, hasSubset, hasPath. Similar: subsets, hasSubset, randomSubset.
function hasSubset(x, y, fc, fm) // x: an object // y: search subset // fc: compare function (a, b) // fm: map function (v, k, x)
const object = require('extra-object'); var x = {a: 1, b: 2, c: 3, d: 4}; var y = {b: 2, d: 4}; object.hasSubset(x, y); // → true var y = {b: -2, d: -4}; object.hasSubset(x, y); // → false object.hasSubset(x, y, (a, b) => Math.abs(a) - Math.abs(b)); // → true object.hasSubset(x, y, null, v => Math.abs(v)); // → true