Skip to main content

Function: any()

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

Like Array.prototype.some, but for iterables.

Example

import { any, pipe } from 'lfi'

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

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

Since

v0.0.1

Call Signature

any<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:174

Call Signature

any<Value>(fn, iterable): boolean

Type Parameters

Value

Parameters

fn

(value) => unknown

iterable

Iterable<Value, any, any>

Returns

boolean

Defined in

predicates.d.ts:174