Skip to main content

Function: includes()

Returns true if any value of iterable is equal to searchElement using Object.is. Otherwise returns false.

Like Array.prototype.includes, but for iterables.

Example

import { includes, pipe } from 'lfi'

console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
includes(`lazy`),
),
)
//=> true

console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
includes(`awake`),
),
)
//=> false
Playground

Since

v0.0.2

Call Signature

includes(searchElement): <Value>(iterable) => boolean

Parameters

searchElement

unknown

Returns

Function

Type Parameters

Value

Parameters

iterable

Iterable<Value, any, any>

Returns

boolean

Defined in

predicates.d.ts:393

Call Signature

includes<Value>(searchElement, iterable): boolean

Type Parameters

Value

Parameters

searchElement

unknown

iterable

Iterable<Value, any, any>

Returns

boolean

Defined in

predicates.d.ts:394