Skip to content
/ dupe Public

📊 Functions to check for, or remove duplicate array items

Notifications You must be signed in to change notification settings

ArtskydJ/dupe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dupe

Functions to check for, or remove duplicate array items.

Build Status

usage

var notDupe = require('dupe')
var isDupe = require('dupe/isDupe')

var duplicates = [1, 2, 1, 3, 4, 1, 3, 4, 'five', 2, 6]
var originals = [4, 8, 15, 16, 23, 42]

// Remove duplicates:
console.log( duplicates.filter( notDupe ) ) // => [1, 2, 3, 4, 'five', 6]
console.log( originals.filter( notDupe ) ) // => [4, 8, 15, 16, 23, 42]

// Assert the lack of duplicates:
console.log( duplicates.every( notDupe ) ) // => false
console.log( originals.every( notDupe ) ) // => true

// Remove originals:
console.log( duplicates.filter( isDupe ) ) // => [1, 1, 3, 4, 2]
console.log( originals.filter( isDupe ) ) // => []

// Assert the presence of duplicates:
console.log( duplicates.some( isDupe ) ) // => true
console.log( originals.some( isDupe ) ) // => false

install

With npm do:

npm install dupe

license

VOL

About

📊 Functions to check for, or remove duplicate array items

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published