Skip to main content

Function: unique()

unique<Value>(iterable): Iterable<Value, any, any>

Returns an iterable containing the values of iterable in iteration order, except values are deduplicated if they are equal using Object.is.

Type Parameters

Value

Parameters

iterable

Iterable<Value, any, any>

Returns

Iterable<Value, any, any>

Example

import { pipe, reduce, toArray, unique } from 'lfi'

console.log(
pipe(
[`sloth`, `lazy`, `lazy`, `sleep`, `sloth`],
unique,
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy', 'sleep' ]
Playground

Since

v0.0.1

Defined in

filters.d.ts:545