is-subset-of

is-subset-of verifies whether an array or an object is a subset.

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
Last updated 5 years ago by thenativeweb-admin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-subset-of 
SYNC missed versions from official npm registry.

is-subset-of

is-subset-of verifies whether an array or an object is a subset.

Status

Category Status
Version npm
Dependencies David
Dev dependencies David
Build GitHub Actions
License GitHub

Installation

$ npm install is-subset-of

Quick Start

First you need to add a reference to is-subset-of to your application:

const { isSubsetOf } = require('is-subset-of');

If you use TypeScript, use the following code instead:

import { isSubsetOf } from 'is-subset-of';

Then you can verify if an array or an object is a subset of another array or object by calling the isSubsetOf function and handing over the arrays or objects:

console.log(isSubsetOf(
  [ 2, 3, 5 ],
  [ 2, 3, 5, 7, 11 ]
));
// => true

console.log(isSubsetOf(
  { name: 'the native web' },
  { name: 'the native web', city: 'Riegel am Kaiserstuhl' },
));
// => true

Verifying subsets structurally

From time to time, you are only interested if one object is a structural subset of another object, i.e. if its keys are contained within the other one, but you want to ignore the values. For that, use the isSubsetOf.structural function:

console.log(isSubsetOf.structural(
  { name: 'Node.js' },
  { name: 'the native web', city: 'Riegel am Kaiserstuhl' }
));
// => true

console.log(isSubsetOf.structural(
  { firstName: 'Golo', lastName: 'Roden' },
  { name: 'the native web' }
));
// => false

Running quality assurance

To run quality assurance for this module use roboter:

$ npx roboter

Current Tags

  • 3.1.10                                ...           latest (5 years ago)

18 Versions

  • 3.1.10 [deprecated]           ...           5 years ago
  • 3.1.9                                ...           5 years ago
  • 3.1.8                                ...           5 years ago
  • 3.1.7                                ...           5 years ago
  • 3.1.6                                ...           5 years ago
  • 3.1.5                                ...           5 years ago
  • 3.1.4                                ...           5 years ago
  • 3.1.3                                ...           5 years ago
  • 3.1.2                                ...           5 years ago
  • 3.1.1                                ...           5 years ago
  • 3.1.0                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |