Function: opaqueAsync()
opaqueAsync<
Value
>(asyncIterable
):AsyncIterable
<Value
,any
,any
>
Returns an async iterable equivalent, but not referentially equal, to
asyncIterable
.
Type Parameters
• Value
Parameters
asyncIterable
AsyncIterable
<Value
, any
, any
>
Returns
AsyncIterable
<Value
, any
, any
>
Example
import { asAsync, opaqueAsync, pipe, reduceAsync, toArray } from 'lfi'
const asyncIterable = asAsync([`sloth`, `lazy`, `sleep`])
asyncIterable.property = 42
const opaqueAsyncIterable = opaqueAsync(asyncIterable)
console.log(asyncIterable === opaqueAsyncIterable)
//=> false
console.log(opaqueAsyncIterable.property)
//=> undefined
console.log(
await pipe(
opaqueAsyncIterable,
reduceAsync(toArray()),
),
)
//=> [ 'sloth', 'lazy', 'sleep' ]
Since
v2.0.0