Easy Tutorial
❮ Sass Tutorial Sass Mixin Include ❯

Sass Map Functions

Sass Functions

Sass Map objects are represented by one or more pairs of key/value.

Sass Maps are immutable, so when processing Map objects, a new Map object is returned instead of modifying the original Map object.

The following table lists the Sass 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. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>map-get($font-sizes, <br> "small") <br>Result: 12px
map-has-key(map, key) Checks if the Map has the specified key, returns true if it exists, otherwise returns false. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>map-has-key($font-sizes, <br> "big") <br>Result: false
map-keys(map) Returns a list of all keys in the Map. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>map-keys($font-sizes) <br>Result: <br> "small", "normal", "large"
map-merge(map1, map2) Merges two Maps into a new Map, appending map2 to the end of map1. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>$font-sizes2: ("x-large": 30px, "xx-large": 36px) <br>map-merge($font-sizes, <br> $font-sizes2) <br>Result: "small": 12px, "normal": 18px, "large": 24px, <br> "x-large": 30px, "xx-large": 36px
map-remove(map, keys...) Removes the specified keys from the Map, multiple keys are separated by commas. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>map-remove($font-sizes, <br> "small") <br>Result: ("normal": 18px, "large": 24px) <br>map-remove($font-sizes, <br> "small", "large") <br>Result: ("normal": 18px)
map-values(map) Returns a list of all values in the Map. <br> <br> Example: <br>$font-sizes: ("small": 12px, "normal": 18px, "large": 24px) <br>map-values($font-sizes) <br>Result: <br> 12px, 18px, 24px

Sass Functions

❮ Sass Tutorial Sass Mixin Include ❯