find-array-duplicate

1.0.2 • Public • Published

find-array-duplicate NPM total downloads

This plugin is to find and return duplicated array elements.

const findDuplicates = require('find-array-duplicate');
const testArr = [ 
    { a: 'a', b: ['a', 'b', { c: 'c' }] },
    { a: 'a', b: ['a', 'b', { c: 'c' }] }, 
    { name: 'Khoa',
        a: {
            b: {
                c: 'c'
            }
        }
    },
    'dev',
    'Khoa',
    1,
    2,
    3,
    'dev',
    {a: 'a', b: ['a', 'b', 'c'] },
    3,
    'Khoa',
    {a: 'a', b: ['a', 'b', 'c'] }
]
 
findDuplicates(testArr);
// [ { value: { a: 'a', b: ['a', 'b', { c: 'c' } ] }, position: [ 0, 1 ] },
//   { value: 'dev', position: [ 3, 8 ] },
//   { value: 'Khoa', position: [ 4, 11 ] },
//   { value: 3, position: [ 7, 10 ] },
//   { value: { a: 'a', b: ['a', 'b', 'c'] }, position: [ 9, 12 ] } ]
 

Related projects

Install

$ npm install find-array-duplicate

Package Sidebar

Install

npm i find-array-duplicate

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

5.53 kB

Total Files

6

Last publish

Collaborators

  • hdkhoa162