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

object-delta

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-delta

deep compares two objects, returns an array of objects containing key paths and deltas

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

object-compare

does a deep compare of two javascript objects and returns an array of differences. this function offers both structural compare, and value compare. structural compare will only report differences in the objects structure, ie type missmatch, missing keys. value compare also checks to see if the values for each key are equivalent. this function was originally written to highly differences between i18n translation file json.

for example: const obj1 = { str: 'string', obj: { key1: 1, key2: 2, key3: false }, int: 5, float: 2.3, bool: true, };

const obj2 = { str: 'string', obj: { key1: "string", key2: 'two', key3: true }, int: 3, float: 2.1, };

objectCompare(obj1, obj2, false); would produce

[ { path: 'obj.key1', firstType: 'number', secondType: 'string', firstValue: 1, secondValue: 'string' }, { path: 'obj.key2', firstType: 'number', secondType: 'string', firstValue: 2, secondValue: 'two' }, { path: 'bool', firstType: 'boolean', secondType: 'undefined', firstValue: true, secondValue: undefined } ]

FAQs

Package last updated on 05 Nov 2019

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