Skip to main content

Variable: unique()

const unique: <Value>(iterable) => Iterable<Value>

Defined in: filters.d.ts:545

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

Value

Parameters

iterable

Iterable<Value>

Returns

Iterable<Value>

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