2.2.0 • Published 9 months ago

@aegenet/belt-array-duplicates v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

npm version

@aegenet/belt-array-duplicates

Strip duplicates from array / get duplicates of an array.

💾 Installation

yarn add @aegenet/belt-array-duplicates@^2.0.0
# or
npm i @aegenet/belt-array-duplicates@^2.0.0

📝 Usage

getDuplicates

import { getDuplicates } from '@aegenet/belt-array-duplicates';

const results = getDuplicates([1, 1, 2]);
// results = [1]
const results = getDuplicates([1, 1, 2, 3, 4, 4]);
// results = [1, 4]

stripDuplicates

import { stripDuplicates } from '@aegenet/belt-array-duplicates';

const results = stripDuplicates([{ id: 1 }, { id: 1 }, { id: 2 }], {
  compare: (a, b) => a.id === b.id,
  sorted: true,
}),
// results = [{ id: 1 }, { id: 2 }]
const a = { id: 1 };
const b = { id: 2 };
const results = stripDuplicates([a, a, b]),
// results = [{ id: 1 }, { id: 2 }]
2.2.0

9 months ago

2.1.0

11 months ago

1.6.2

12 months ago

1.7.0

12 months ago

1.6.1

12 months ago

2.0.0

12 months ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

2 years ago