Map
Sass map helper functions for data manipulation.
is-map()
Checks if a variable is a Sass map.
Parameter | Type | Default Value | Description |
---|---|---|---|
$var | any | - | 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.
Parameter | Type | Default Value | Description |
---|---|---|---|
$map | list | - | The list to search in |
$val | any | - | 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.
Parameter | Type | Default Value | Description |
---|---|---|---|
$values | map | - | 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.
Parameter | Type | Default Value | Description |
---|---|---|---|
$values | map | - | The map to search in |
$sub-value | number | 0 | The index of the sub-value to compare |
$return | string | "value" | What to return (value, key, or complete) |
scss
$largest: getLargestValue(
(
a: 10,
b: 20,
c: 15,
)
);
// Returns: 20
scss
20