@ngard/tiny-unique

1.0.0 • Public • Published

tiny-unique

source bundle size build status license

A minimal utility similar to lodash.uniq. For when every byte counts! Returns a copy of the passed array with only the first of any duplicate values included.


lodash.uniq: bundle size
tiny-unique: bundle size


Syntax

unique(/* array [, comparator] */);

Parameters

array - An array of possibly duplicated values comparator - An optional function that compares two values for equality. Defaults to ===.

Returns

An array containing only the first occurrence of each value in the passed array, in the order that they occur.

Use

import { unique } from '@ngard/tiny-unique';

const set = unique([1, true, 'foo', 3, 1, true]);
// set is [1, true, 'foo', 3]

Readme

Keywords

Package Sidebar

Install

npm i @ngard/tiny-unique

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

11.9 kB

Total Files

8

Last publish

Collaborators

  • ngard