Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-subset

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-subset

Check if an object is contained within another one

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is is-subset?

The is-subset npm package is a utility that allows you to check if one set of values is a subset of another. This can be particularly useful for validating data structures, filtering data, and performing set operations in JavaScript.

What are is-subset's main functionalities?

Basic Subset Check

This feature allows you to check if one object is a subset of another. In this example, object `b` is a subset of object `a` because all key-value pairs in `b` exist in `a`.

const isSubset = require('is-subset');
const a = { foo: 'bar', baz: 42 };
const b = { foo: 'bar' };
console.log(isSubset(a, b)); // true

Array Subset Check

This feature allows you to check if one array is a subset of another. In this example, array `b` is a subset of array `a` because all elements in `b` exist in `a`.

const isSubset = require('is-subset');
const a = [1, 2, 3, 4];
const b = [2, 3];
console.log(isSubset(a, b)); // true

Nested Object Subset Check

This feature allows you to check if one nested object is a subset of another. In this example, object `b` is a subset of object `a` because the nested structure and values in `b` exist in `a`.

const isSubset = require('is-subset');
const a = { foo: { bar: 'baz' }, qux: 42 };
const b = { foo: { bar: 'baz' } };
console.log(isSubset(a, b)); // true

Other packages similar to is-subset

Keywords

FAQs

Package last updated on 29 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc