Normal People, MMM!

    @black_hole/array-equals

    1.1.3 • Public • Published

    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

    Commits Contributor
    5 Black-Hole

    Author

    Black-Hole

    Install

    npm i @black_hole/array-equals

    DownloadsWeekly Downloads

    0

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    11.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • black_hole