Skip to main content

Function: dropWhileAsync()

Returns an async iterable containing the values of asyncIterable in iteration order starting with the first value for which fn returns a value awaitable to a falsy value.

Example

console.log(
await pipe(
asAsync([1, 2, 3, 4, 5, 6, 7, 8, `sloth`]),
dropWhileAsync(value => value < 5),
reduceAsync(toArray()),
),
)
//=> [ 5, 6, 7, 8, 'sloth' ]

dropWhileAsync(fn)

dropWhileAsync<Value>(fn): (asyncIterable) => AsyncIterable<Value, any, any>

Returns an async iterable containing the values of asyncIterable in iteration order starting with the first value for which fn returns a value awaitable to a falsy value.

Type Parameters

Value

Parameters

fn

Returns

Function

Parameters

asyncIterable: AsyncIterable<Value, any, any>

Returns

AsyncIterable<Value, any, any>

Example

console.log(
await pipe(
asAsync([1, 2, 3, 4, 5, 6, 7, 8, `sloth`]),
dropWhileAsync(value => value < 5),
reduceAsync(toArray()),
),
)
//=> [ 5, 6, 7, 8, 'sloth' ]

Defined in

splices.d.ts:48

dropWhileAsync(fn, asyncIterable)

dropWhileAsync<Value>(fn, asyncIterable): AsyncIterable<Value, any, any>

Returns an async iterable containing the values of asyncIterable in iteration order starting with the first value for which fn returns a value awaitable to a falsy value.

Type Parameters

Value

Parameters

fn

asyncIterable: AsyncIterable<Value, any, any>

Returns

AsyncIterable<Value, any, any>

Example

console.log(
await pipe(
asAsync([1, 2, 3, 4, 5, 6, 7, 8, `sloth`]),
dropWhileAsync(value => value < 5),
reduceAsync(toArray()),
),
)
//=> [ 5, 6, 7, 8, 'sloth' ]

Defined in

splices.d.ts:48