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

@codefeathers/iseq

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codefeathers/iseq

Deep compare objects and arrays

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

isEq -- Deep-compare objects

isEq is a very tiny module that deep compares objects or arrays.

Although its intention is deep comparison, isEq can compare several datatypes.

Supports

DatatypeSupport
Number
String
Boolean
Object
Array
Cyclic Object/Array
Regexp
Function
Symbol

Note: functions and symbols are compared by identity. Regexp is stringified before comparison. Unhandleable inputs fall back to strict equality (===)

Installation

Node:

npm install --save @codefeathers/iseq

In the browser:

<script src="https://unpkg.com/@codefeathers/iseq">

Usage

isEq(<sourceObject>, <compareObject>, [comparisonKeys])

where if comparison keys are not given, compareObject is compared against all keys of sourceObject.

Example

So you want to filter all the entities in Steins;Gate that have the property isEvil: true.

var entities = [
	{
		name: 'Future Gadget Laboratory',
		isEvil: false,
		after: 'Disrupting the status quo',
		"known-members": [
			{ name: 'Okabe Rintarou', gender: 'Male', occupation: 'University student' },
			{ name: 'Mayuri Shiina', gender: 'Female', occupation: 'Maid at May Queen' },
			{ name: 'Itaru Hashida', gender: 'Male', occupation: 'Hacker' },
		],
	},
	{
		name: 'SERN',
		isEvil: true,
		after: 'IBN 5100',
		"known-members": [
			{ name: 'Yuugo Tennouji', gender: 'Male', occupation: 'CRT mechanic' },
			{ name: 'Moeka Kiryū', gender: 'Female', occupation: 'Part-time editor' },
		],
	},
	{
		name: 'Strategic Focus',
		isEvil: true,
		after: 'Time travel',
		"known-members": [
			{ name: 'Alexis Leskinen', gender: 'Male', occupation: 'Professor' },
		],
	},
]

const evilEntities = entities.filter(eachEntity => isEq(eachEntity, { isEvil: true }, ['isEvil']));



Written by @MKRhere

Keywords

FAQs

Package last updated on 12 May 2018

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