Skip to content

Map

Sass map helper functions for data manipulation.

is-map()

Checks if a variable is a Sass map.

ParameterTypeDefault ValueDescription
$varany-The variable to check
scss
$is-map: is-map(
    (
        key: value,
    )
);
// Returns: true
scss
true

index-exists()

Checks if a value exists in a list.

ParameterTypeDefault ValueDescription
$maplist-The list to search in
$valany-The value to search for
scss
$exists: index-exists((a, b, c), b);
// Returns: true
scss
true

getFirstKey()

Returns the first key of a map.

ParameterTypeDefault ValueDescription
$valuesmap-The map to get the first key from
scss
$first: getFirstKey(
    (
        a: 1,
        b: 2,
        c: 3,
    )
);
// Returns: a
scss
a

getLargestValue()

Returns the largest value from a map.

ParameterTypeDefault ValueDescription
$valuesmap-The map to search in
$sub-valuenumber0The index of the sub-value to compare
$returnstring"value"What to return (value, key, or complete)
scss
$largest: getLargestValue(
    (
        a: 10,
        b: 20,
        c: 15,
    )
);
// Returns: 20
scss
20