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

json-subset

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-subset

Determine whether one json object is a subset of another json object

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-89.66%
Maintainers
1
Weekly downloads
 
Created
Source

json-subset

return whether one json object is a subset of another json object

uses a recursive depth-first-search algorithm to compare for equality across depth levels.

Equality is checked using the toString() representation of each leaf node. Objects are recursively checked.

NOTE: This can be very expensive for deep json objects.

installation

npm install json-subset

jsonSubset(a,b)

returns a boolean indicating whether json a is a subset of b

usage

var subset = require('json-subset')

console.log(subset(
  { a: 'a' },
  { a: 'a', b: 'b' }
))

console.log(subset(
  { a: 'a', b: 'b' },
  { a: 'a' }
))

output

true
false

Keywords

FAQs

Package last updated on 12 Oct 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