Sass Map Func
# Sass Map (Mapping) Functions
[ Sass Functions](#)
A Sass Map (mapping) object is represented by one or more key/value pairs.
Sass Maps are immutable, so when processing a Map object, a new Map object is returned instead of modifying the original Map object.
The following table lists Sass's Map functions:
| Function | Description & Example |
| --- | --- |
| map-get(_map_, _key_) | Returns the value corresponding to the _key_ in the map. If the key does not exist, it returns null. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) map-get($font-sizes, "small") Result: 12px |
| map-has-key(_map_, _key_) | Checks if the map has the corresponding _key_. Returns true if it exists, otherwise returns false. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) map-has-key($font-sizes, "big") Result: false |
| map-keys(_map_) | Returns a list of all the keys in the map. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) map-keys($font-sizes) Result: "small", "normal", "large" |
| map-merge(_map1_, _map2_) | Merges two maps to form a new map, appending _map2_ to the end of _map1_. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) $font-sizes2: ("x-large": 30px, "xx-large": 36px) map-merge($font-sizes, $font-sizes2) Result: "small": 12px, "normal": 18px, "large": 24px, "x-large": 30px, "xx-large": 36px |
| map-remove(_map_, _keys..._) | Removes the specified keys from the map. Multiple keys are separated by commas. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) map-remove($font-sizes, "small") Result: ("normal": 18px, "large": 24px) map-remove($font-sizes, "small", "large") Result: ("normal": 18px) |
| map-values(_map_) | Returns all the values in the map as a list. **Example:** $font-sizes: ("small": 12px, "normal": 18px, "large": 24px) map-values($font-sizes) Result: 12px, 18px, 24px |
* * Sass Functions](#)
YouTip