array-key-object-uniq

0.5.0 • Public • Published

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.

Package Sidebar

Install

npm i array-key-object-uniq

Weekly Downloads

0

Version

0.5.0

License

ISC

Unpacked Size

13.7 kB

Total Files

8

Last publish

Collaborators

  • orivoir21