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: truescss
trueindex-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: truescss
truegetFirstKey()
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: ascss
agetLargestValue()
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: 20scss
20