Skip to content

none

Summary

True if no elements of a list satisfied given predicate.

Tip

This function is curried.

Description

Returns true if predicate returned logical false for all elements of the list. When a predicate returns logical true, the function returns false immediately.

Examples

Check that a list does not contain any 'x'

1
2
3
4
5
6
7
const no_x = none(eq('x'));

no_x(['a', 'b', 'c']);          //=> true
no_x(['a', 'x', 'c']);          //=> false

no_x({m: 'a', n: 'b', o: 'c'}); //=> true
no_x({m: 'a', n: 'x', o: 'c'}); //=> false

Parameters

Name Type Description
pred function Predicate
xs Array or Object List of values

Return

boolean