Function: includesAsync()
Returns a promise that resolves to true
if any value of asyncIterable
is
equal to searchElement
using Object.is
. Otherwise returns a promise that
resolves to false
.
Like Array.prototype.includes
, but for async iterables.
Example
console.log(
await pipe(
asAsync([`sloth`, `more sloth`, `even more sloth`]),
includesAsync(3),
),
)
//=> true
includesAsync(searchElement)
includesAsync(
searchElement
): <Value
>(asyncIterable
) =>Promise
<boolean
>
Returns a promise that resolves to true
if any value of asyncIterable
is
equal to searchElement
using Object.is
. Otherwise returns a promise that
resolves to false
.
Like Array.prototype.includes
, but for async iterables.
Parameters
• searchElement: unknown
Returns
Function
Type Parameters
• Value
Parameters
• asyncIterable: AsyncIterable
<Value
, any
, any
>
Returns
Promise
<boolean
>
Example
console.log(
await pipe(
asAsync([`sloth`, `more sloth`, `even more sloth`]),
includesAsync(3),
),
)
//=> true
Defined in
includesAsync(searchElement, asyncIterable)
includesAsync<
Value
>(searchElement
,asyncIterable
):Promise
<boolean
>
Returns a promise that resolves to true
if any value of asyncIterable
is
equal to searchElement
using Object.is
. Otherwise returns a promise that
resolves to false
.
Like Array.prototype.includes
, but for async iterables.
Type Parameters
• Value
Parameters
• searchElement: unknown
• asyncIterable: AsyncIterable
<Value
, any
, any
>
Returns
Promise
<boolean
>
Example
console.log(
await pipe(
asAsync([`sloth`, `more sloth`, `even more sloth`]),
includesAsync(3),
),
)
//=> true