Distopico Vegan 9e639edc8d | 6 years ago | |
---|---|---|
.. | ||
module | 6 years ago | |
License.md | 6 years ago | |
Readme.md | 6 years ago | |
index.js | 6 years ago | |
module.js | 6 years ago | |
package.json | 6 years ago | |
test.js | 6 years ago |
Check if an object is contained within another one.
$ npm install is-subset
import isSubset from 'is-subset/module';
// …or:
var isSubset = require('is-subset');
isSubset(
{a: 1, b: 2},
{a: 1}
);
isSubset(
{a: 1, b: {c: 3, d: 4}, e: 5},
{a: 1, b: {c: 3}}
);
isSubset(
{a: 1, bcd: [1, 2, 3]},
{a: 1, bcd: [1, 2]}
);
…and these are false:
isSubset(
{a: 1},
{a: 2}
);
isSubset(
{a: 1},
{a: 1, b: 2}
);
isSubset(
{a: 1, bcd: [1, 2, 3]},
{a: 1, bcd: [1, 3]}
);
See the specs for more info.
Check if an object is contained within another object.
Returns true
if:
Parameters:
Object
supersetObject
subsetReturn value:
Boolean