🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

microdiff

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microdiff

Small, fast, zero dependency deep object and array comparison

1.3.0
Source
npm
Version published
Weekly downloads
276K
-15.26%
Maintainers
1
Weekly downloads
 
Created

What is microdiff?

The microdiff npm package is a lightweight utility for calculating the differences between two JavaScript objects. It is designed to be fast and efficient, making it suitable for applications where performance is critical.

What are microdiff's main functionalities?

Basic Object Diffing

This feature allows you to find the differences between two simple objects. The code sample demonstrates how to use microdiff to compare two objects and log the differences.

const diff = require('microdiff');
const obj1 = { a: 1, b: 2 };
const obj2 = { a: 1, b: 3 };
const differences = diff(obj1, obj2);
console.log(differences);

Nested Object Diffing

This feature allows you to find differences in nested objects. The code sample shows how microdiff can be used to compare nested objects and identify changes at any level of depth.

const diff = require('microdiff');
const obj1 = { a: 1, b: { c: 2, d: 3 } };
const obj2 = { a: 1, b: { c: 2, d: 4 } };
const differences = diff(obj1, obj2);
console.log(differences);

Array Diffing

This feature allows you to find differences between arrays. The code sample demonstrates how microdiff can be used to compare two arrays and log the differences.

const diff = require('microdiff');
const arr1 = [1, 2, 3];
const arr2 = [1, 2, 4];
const differences = diff(arr1, arr2);
console.log(differences);

Other packages similar to microdiff

Keywords

diff

FAQs

Package last updated on 26 Dec 2021

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