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

@black_hole/array-equals

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@black_hole/array-equals

check if two arrays are equal

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

Array-equals

Node Version Build Status Coverage Status Npm Downlaod

install

# Install with npm
$ npm install @black_hole/array-equals --save

# Install with yarn
$ yarn add @black_hole/array-equals

Usage

Two arrays are equal

let arrEquals = require('@black_hole/array-equals')

let arr1 = [1, 2, 3]
let arr2 = [1, 2, 3]
let result = arrEquals(arr1, arr2) // => true

Two arrays are not equal

let arrEquals = require('@black_hole/array-equals')

let arr1 = [1, 2, 3]
let arr2 = [1, 2, 4]
let result = arrEquals(arr1, arr2) // => false

Arrays of different lengths are not equal

let arrEquals = require('@black_hole/array-equals')

let arr1 = [1, 2, 3]
let arr2 = [1, 2, 3, 4]
let result = arrEquals(arr1, arr2) // => false

Multidimensional array are equal

let arrEquals = require('@black_hole/array-equals')

let arr1 = [1, 2, 3, [4, 5, 6]]
let arr2 = [1, 2, 3, [4, 5, 6]]
let result = arrEquals(arr1, arr2) // => true

Arguments(like-Array) are equal

let arrEquals = require('@black_hole/array-equals')

function likeArr () {
    let arr2 = [1, 2, 3]
    return arrEquals(arguments, arr2, true)
}
likeArr(1, 2, 3) // => true

Depth judgment

let arrEquals = require('@black_hole/array-equals')

let arr1 = [1, {
    'a': 1,
    'b': ['x', null, -0]
}]
let arr2 = [1, {
    'a': 1,
    'b': ['x', null, 0]
}]
let result = arrEquals(arr1, arr2) // => false

Contributing

CommitsContributor
5Black-Hole

Author

Black-Hole

Keywords

FAQs

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