Renamed!
This package has been renamed to @sass-fairy/map
and organised in a mono-repo for better maintainablity, an improved user experience, and full documentation. Explore more about the change at sass-fairy.com.
This Sass module provides more advanced map functions.
- Dart Sass:
>=1.33.0
Install the package:
npm install sass-module-map
Use the package like any other Sass module:
@use 'sass-module-map';
Depending on your setup, you may need to configure node_modules
as include path:
const sass = require('sass');
sass.render({
file: scss_filename,
includePaths: ['node_modules']
});
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.
compare-key ()
,compare-key-desc ()
-
Returns a function reference to the map key comparison method used by the sort function.
compare-key ( $first-pair, $second-pair )
- Used to compare 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 )
- Used to compare 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 ()
,compare-numeric-value-desc ()
-
Returns a function reference to the numeric map value comparison method used by the sort function.
compare-numeric-value ( $first-pair, $second-pair [, $center] )
- Used to compare 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] )
- Used to compare two key/value pairs' values as numbers in descending order. All non-numeric items are shifted left.
compare-value ()
,compare-value-desc ()
-
Returns a function reference to the map value comparison method used by the sort function.
compare-value ( $first-pair, $second-pair )
- Used to compare 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 )
- Used to compare 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.
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-module-map';
@use 'sass:map';
// ...this statement will accomplish the same thing.
@use 'sass-module-map/map';