every ()
Tests whether all items in a list satisfy 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 every 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.every($list, meta.get-function('_greater-than-fifty'));
// false