Skip to main content

Function: all()

Returns true if fn returns a truthy value for all values of iterable. Otherwise returns false.

Like Array.prototype.every, but for iterables.

Example

import { all, pipe } from 'lfi'

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

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

Since

v0.0.1

Call Signature

all<Value>(fn): (iterable) => boolean

Type Parameters

Value

Parameters

fn

(value) => unknown

Returns

Function

Parameters

iterable

Iterable<Value, any, any>

Returns

boolean

Defined in

predicates.d.ts:62

Call Signature

all<Value>(fn, iterable): boolean

Type Parameters

Value

Parameters

fn

(value) => unknown

iterable

Iterable<Value, any, any>

Returns

boolean

Defined in

predicates.d.ts:62