1.0.4 • Published 4 years ago

@relativemarketing/duplicates v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

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]
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago