Skip to main content

Function: opaque()

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

Returns an iterable equivalent, but not referentially equal, to iterable.

Type Parameters

Value

Parameters

iterable

Iterable<Value, any, any>

Returns

Iterable<Value, any, any>

Example

import { opaque } from 'lfi'

const array = [`sloth`, `lazy`, `sleep`]
const iterable = opaque(array)

console.log(array === iterable)
//=> false

console.log([...iterable])
//=> [ 'sloth', 'lazy', 'sleep' ]
Playground

Since

v2.0.0

Defined in

core.d.ts:436