🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

similar-to

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

similar-to

A deepEqual a like that doesn't checks values. It's all about similarity :)

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Similar To

Verifies if two objects are similar.

Full Similarity

Two objects are meant to be fully similar if ALL of its fields are present in the other object. As similarity is different from equality, this module won't check for the values of the fields (this differs from deepEqual).

var fullySimilar = require('similar-to');

var a = {a: {b: "c"}, b: "c"};
var b = {a: {b: "d"}, b: "e"};

fullySimilar(a,b);

// true

Partial Similarity

Partial similarity is meant to be the same case as the one stated above but for only a part of the second object being passed through.

var partiallySimilar = require('similar-to');

var a = {a: {b: "c"}, b: "c"};
var b = {a: {b: "d"}};

// the last argument specifies that the check will be for partial similarity
partiallySimilar(b, a, true);

// true

FAQs

Package last updated on 03 Sep 2014

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