array-key-object-uniq

do you have needs check duplicate value inside complex item array ?

Usage no npm install needed!

<script type="module">
  import arrayKeyObjectUniq from 'https://cdn.skypack.dev/array-key-object-uniq';
</script>

README

array-key-object-uniq

do you have needs check duplicate value inside complex item array ?

installation

  • npm install array-key-object-uniq --save

  • yarn add array-key-object-uniq

usage

index.js


const arrayKeyObjectUniq = require('array-key-object-uniq') ;

const myArray = [
    {
        username: "Foo",
        isLicorn: false
    } , {
        username: "Bar",
        isLicorn: false
    } , {
        username: "FooBar",
        isLicorn: true
    }, {
        username: "Foo",
        isLicorn: false
    }
] ;

const resolveMyArray = arrayKeyObjectUniq( myArray ) ;

console.log( resolveMyArray ) ;

output

[
    "Foo",false,
    "Bar",
    "FooBar",true
]

inline array

you can just transform your complex array in inline array with: require('array-key-object-uniq/lib/inline-transform')

inline array usage

index.js

const inlineArray = require('array-key-object-uniq/lib/inline-transform') ;

const myArray = [
    {
        username: "Foo",
        isLicorn: false
    } , {
        username: "Bar",
        isLicorn: false
    } , {
        username: "FooBar",
        isLicorn: true
    }, {
        username: "Foo",
        isLicorn: false
    }
] ;

const myInlineArray = inlineArray( myArray ) ;

console.log( myInlineArray ) ;

output

[
    "Foo", false,
    "Bar", false,
    "FooBar", true,
    "Foo", false
]

The inline-array module not applicate filter this the module call by array-key-object-uniq before filter final values, if you have needs applicate custom filter, you should use: inline-array module.

currently inline-array is not installable in standalone this is possible for next minor version: 0.6.0.