Skip to main content

includes ()

Determines whether a list includes a certain value among its items, returning true or false as appropriate.

Parameters

$list
The list to be check.
Type
List
$value
The value to search for in the list.
Type
*
$start-at
The index in this list at which to begin searching for value. A negative index can be used, indicating an offset from the end of the list.
Type
Number
Default
1

Return Value

Boolean
true if the value is found anywhere within the given list; otherwise, false.

Example

@use '@sass-fairy/list';

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

// 1. Check if the list includes `79`
@debug list.includes($list, 79);
// true

// 2. Check if the list includes `65` starting at a specific index
@debug list.includes($list, 65, 4);
// false