Skip to main content

API Overview

Functions​

empty ()

Creates an empty map.

from ( $key-value... )

Creates a map from the provided key/value pairs.

to-string ( $map )

Returns a string representing the specified map and its key/value pairs.

Don’t see the function you’re looking for? Request a new feature describing a use case.

Reference Functions​

compare-key ( $first-pair, $second-pair ) [+1 overload]

Compares two key/value pairs’ keys by converting them to strings, then comparing the value’s sequences of UTF-16 code units values in ascending order. All null items are shifted right.

compare-key-desc ( $first-pair, $second-pair ) [+1 overload]

Compares two key/value pairs’ keys by converting them to strings, then comparing the value’s sequences of UTF-16 code units values in descending order. All null items are shifted left.

compare-numeric-value ( $first-pair, $second-pair [, $center] ) [+1 overload]

Compares two key/value pairs’ values as numbers in ascending order. All non-numeric items are shifted right.

compare-numeric-value-desc ( $first-pair, $second-pair [, $center] ) [+1 overload]

Compares two key/value pairs’ values as numbers in descending order. All non-numeric items are shifted left.

compare-value ( $first-pair, $second-pair ) [+1 overload]

Compares two key/value pairs’ values by converting them to strings, then comparing the value’s sequences of UTF-16 code units values in ascending order. All null items are shifted right.

compare-value-desc ( $first-pair, $second-pair ) [+1 overload]

Compares two key/value pairs’ values by converting them to strings, then comparing the value’s sequences of UTF-16 code units values in descending order. All null items are shifted left.

More information on comparison logic and reference functions.

Combined API​

In order to avoid constantly declaring both the native sass:map module and this library, the combined API has been added which merges the two.

// Rather than using both modules separately...
@use '@sass-fairy/map';
@use 'sass:map';

// ...this statement will accomplish the same thing.
@use '@sass-fairy/map/map';