Skip to main content

some ()

Tests whether at least one item in a list satisfies the test implemented by the specified function.

Parameters

$list
The list from which items will be tested.
Type
List
$predicate
The function that tests each item for a condition. The first parameter is the current item being processed in the list. The second parameter is the index of the current item being processed in the list. The third parameter is the list being processed. The returned value will be compared for truthiness.
Type
Function
$args
Additional parameters which are provided to predicate function.
Type
ArgList
Default
()

Return Value

Boolean
true if the predicate function returns a truthy value for at least one item in the list; otherwise, false.

Example

@use 'sass:meta';
@use '@sass-fairy/list';

@function _greater-than-fifty($item, $void...) {
@return $item > 50;
}

$list: 32 8 65 79 34 8 13 66 18;

@debug list.some($list, meta.get-function('_greater-than-fifty'));
// true