de_duplicated
this is a package to delete the duplicated elements in array
Last updated 6 months ago by miladezzat .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install de_duplicated 
SYNC missed versions from official npm registry.

De Duplicated npm version GitHub forks GitHub issues GitHub stars Build Status

This is package for deleting the duplicated elements in array, there are contain two methods, first method called simpleArray, this method de_duplicated the simple elements just numbers or strings or both, and second method is complexArray the de_duplicated object elements in array

Getting Started

download the package in your prject and require it, and use it

Prerequisites

you should have node.js in your local machine

no examples

Installing

open terminale and go to your project directory and write

    npm install de_duplicated

How To Use it

After install package

  1. Examples for simple array:
//example 1
const DE_Duplicated = require('de_duplicated')

let simpleArray = [2, 5, 8, 2, 2, 8, 5, 2, 3];

let uniqueSimpleArray = DE_Duplicated.simpleArray(simpleArray);

console.log(uniqueSimpleArray);
//result
    //[ 2, 5, 8, 3 ]
//example 2
const DE_Duplicated = require('de_duplicated')

let simpleArray = ['john', 'milad', 'Milad', 'john', 'John'];

let uniqueSimpleArray = DE_Duplicated.simpleArray(simpleArray);

console.log(uniqueSimpleArray);
// result
    //[ 'john', 'milad' ]

   // Note that: The simpleArray method case insenstive for string 
 //example 3
const DE_Duplicated = require('de_duplicated')

let simpleArray = [1, 2, 1, 2, 5, 8, 8, 5, 'john', 'milad', 'Milad', 'john', 'John'];

let uniqueSimpleArray = DE_Duplicated.simpleArray(simpleArray);

console.log(uniqueSimpleArray);
//result
    //[ 1, 2, 5, 8, 'john', 'milad' ]

    //Note That: The simpleArray method case insenstive for string 
  1. Examples for complex array
    //example 1
const DE_Duplicated = require('de_duplicated')

let compexArray = [
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "Milad", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 3, name: "Milad", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "Milad", age: 24 },
]

let uniqueCompexArray = DE_Duplicated.complexArray(compexArray, 'id');

console.log(uniqueCompexArray);
// result
   /* [
        { id: 1, name: 'Milad', age: 24 },
        { id: 2, name: 'Milad', age: 24 },
        { id: 3, name: 'Milad', age: 24 }
    ]*/
    //example 2
const DE_Duplicated = require('de_duplicated')

let compexArray = [
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "John", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 3, name: "John", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "Milad", age: 24 },
]

let uniqueCompexArray = DE_Duplicated.complexArray(compexArray, 'name');

console.log(uniqueCompexArray);
//result
    //[ { id: 1, name: 'Milad', age: 24 }, { id: 2, name: 'John', age: 24 } ]
    //example 3
const DE_Duplicated = require('de_duplicated')

let compexArray = [
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "milad", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 3, name: "milad", age: 24 },
    { id: 1, name: "Milad", age: 24 },
    { id: 2, name: "Milad", age: 24 },
]

let uniqueCompexArray = DE_Duplicated.complexArray(compexArray, 'name');

console.log(uniqueCompexArray);
//resulat
    /*[
    { id: 1, name: 'Milad', age: 24 },
    { id: 2, name: 'milad', age: 24 }
    ]*/

    //Note that : The complexArray method case senstive for string 

Running the tests

Break down into end to end tests

Not now an example

And coding style tests

Explain what these tests test and why

Give an example

Deployment

Add additional notes about how to deploy this on a live system

Built With

Contributing

Versioning

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Current Tags

  • 1.0.6                                ...           latest (6 months ago)

5 Versions

  • 1.0.6                                ...           6 months ago
  • 1.0.5                                ...           6 months ago
  • 1.0.4                                ...           6 months ago
  • 1.0.3                                ...           6 months ago
  • 1.0.2                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |