Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duplicates

This provides methods for working finding and removing duplicate items across arrays.

duplicates.find()

Will return an array containing all values that exist more than once or an empty array if there are no duplicates.

Usage:

import duplicates from '@relativemarketing/duplicates'

const a = ['a', 'b', 'c', 'd']
const b = ['a', 'b']
const c = ['d', 'e', 'f']

duplicates.find(a, b, c) // ['a', 'b', 'd']
import { find } from '@relativemarketing/duplicates'

const a = ['a', 'b', 'c']
const b = ['a', 'b', 'd']

find(a, b) // ['a', 'b']

duplicates.remove()

Will remove any items that appear more than once.

import duplicates from '@relativemarketing/duplicates'

const a = ['a', 'b', 'c', 'd']
const b = ['a', 'b']
const c = ['d', 'e', 'f']

duplicates.remove(a, b, c) // ['c', 'e', 'f']
import {remove} from '@relativemarketing/duplicates'

const a = ['a', 'b', 'c', 'd']
const b = ['a', 'b']
const b = ['d', 'e', 'f']

remove(a, b, c) // ['c', 'e', 'f']

duplicates.strip(unwantedItems).from(wantedItems)

Will strip all unwanted items from a list of wanted items

import duplicates from '@relativemarketing/duplicates'

duplicates.strip([1,2]).from([1,2,3]) // [3]

About

Provides methods for finding and removing duplicate items across arrays.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages