2023-05-29 19:39:35 +02:00
|
|
|
---
|
|
|
|
title: sass:map
|
|
|
|
---
|
|
|
|
|
2023-06-03 00:18:43 +02:00
|
|
|
{% render 'doc_snippets/built-in-module-status' %}
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
{% funFact %}
|
|
|
|
Sass libraries and design systems tend to share and override configurations
|
|
|
|
that are represented as nested maps (maps that contain maps that contain
|
|
|
|
maps).
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
To help you work with nested maps, some map functions support deep operations.
|
|
|
|
For example, if you pass multiple keys to `map.get()`, it will follow those
|
|
|
|
keys to find the desired nested map:
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map', false %}
|
|
|
|
$config: (a: (b: (c: d)));
|
|
|
|
@debug map.get($config, a, b, c); // d
|
|
|
|
===
|
|
|
|
$config: (a: (b: (c: d)))
|
|
|
|
@debug map.get($config, a, b, c) // d
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunFact %}
|
|
|
|
|
|
|
|
{% function 'map.deep-merge($map1, $map2)', 'returns:map' %}
|
2023-06-02 23:36:10 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}{% endcompatibility %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Identical to [`map.merge()`](#merge), except that nested map values are *also*
|
|
|
|
recursively merged.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-deep-merge', false %}
|
|
|
|
$helvetica-light: (
|
|
|
|
"weights": (
|
|
|
|
"lightest": 100,
|
|
|
|
"light": 300
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$helvetica-heavy: (
|
|
|
|
"weights": (
|
|
|
|
"medium": 500,
|
|
|
|
"bold": 700
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
@debug map.deep-merge($helvetica-light, $helvetica-heavy);
|
|
|
|
// (
|
|
|
|
// "weights": (
|
|
|
|
// "lightest": 100,
|
|
|
|
// "light": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
@debug map.merge($helvetica-light, $helvetica-heavy);
|
|
|
|
// (
|
|
|
|
// "weights": (
|
|
|
|
// "medium: 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
===
|
|
|
|
$helvetica-light: ("weights": ("lightest": 100, "light": 300))
|
|
|
|
$helvetica-heavy: ("weights": ("medium": 500, "bold": 700))
|
|
|
|
|
|
|
|
@debug map.deep-merge($helvetica-light, $helvetica-heavy)
|
|
|
|
// (
|
|
|
|
// "weights": (
|
|
|
|
// "lightest": 100,
|
|
|
|
// "light": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
@debug map.merge($helvetica-light, $helvetica-heavy);
|
|
|
|
// (
|
|
|
|
// "weights": (
|
|
|
|
// "medium: 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.deep-remove($map, $key, $keys...)', 'returns:map' %}
|
2023-06-02 23:36:10 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}{% endcompatibility %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is empty, returns a copy of `$map` without a value associated with
|
|
|
|
`$key`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-deep-remove', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.deep-remove($font-weights, "regular");
|
|
|
|
// ("medium": 500, "bold": 700)
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.deep-remove($font-weights, "regular")
|
|
|
|
// ("medium": 500, "bold": 700)
|
|
|
|
{% endcodeExample %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
---
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is not empty, follows the set of keys including `$key` and
|
|
|
|
excluding the last key in `$keys`, from left to right, to find the nested map
|
|
|
|
targeted for updating.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a copy of `$map` where the targeted map does not have a value
|
|
|
|
associated with the last key in `$keys`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-deep-remove-2', false %}
|
|
|
|
$fonts: (
|
|
|
|
"Helvetica": (
|
|
|
|
"weights": (
|
|
|
|
"regular": 400,
|
|
|
|
"medium": 500,
|
|
|
|
"bold": 700
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
@debug map.deep-remove($fonts, "Helvetica", "weights", "regular");
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights: (
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
===
|
|
|
|
$fonts: ("Helvetica": ("weights": ("regular": 400, "medium": 500, "bold": 700)))
|
|
|
|
|
|
|
|
@debug map.deep-remove($fonts, "Helvetica", "weights", "regular")
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights: (
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.get($map, $key, $keys...)', 'map-get($map, $key, $keys...)' %}
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is empty, returns the value in `$map` associated with `$key`.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$map` doesn't have a value associated with `$key`, returns [`null`][].
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
[`null`]: /documentation/values/null
|
2023-05-31 01:39:56 +02:00
|
|
|
|
2023-06-03 00:18:43 +02:00
|
|
|
{% render 'code_snippets/example-map-get' %}
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
---
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-03 00:02:34 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}
|
|
|
|
Only Dart Sass supports calling `map.get()` with more than two arguments.
|
|
|
|
{% endcompatibility %}
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is not empty, follows the set of keys including `$key` and
|
|
|
|
excluding the last key in `$keys`, from left to right, to find the nested map
|
|
|
|
targeted for searching.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns the value in the targeted map associated with the last key in `$keys`.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns [`null`][] if the map does not have a value associated with the key,
|
|
|
|
or if any key in `$keys` is missing from a map or references a value that is
|
|
|
|
not a map.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
[`null`]: /documentation/values/null
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
{% codeExample 'map-deep-remove-2', false %}
|
|
|
|
$fonts: (
|
|
|
|
"Helvetica": (
|
|
|
|
"weights": (
|
|
|
|
"regular": 400,
|
|
|
|
"medium": 500,
|
|
|
|
"bold": 700
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
@debug map.get($fonts, "Helvetica", "weights", "regular"); // 400
|
|
|
|
@debug map.get($fonts, "Helvetica", "colors"); // null
|
|
|
|
===
|
|
|
|
$fonts: ("Helvetica": ("weights": ("regular": 400, "medium": 500, "bold": 700)))
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
@debug map.get($fonts, "Helvetica", "weights", "regular") // 400
|
|
|
|
@debug map.get($fonts, "Helvetica", "colors") // null
|
|
|
|
{% endcodeExample %}
|
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.has-key($map, $key, $keys...)', 'map-has-key($map, $key, $keys...)', 'returns:boolean' %}
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is empty, returns whether `$map` contains a value associated with
|
|
|
|
`$key`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-has-key', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.has-key($font-weights, "regular"); // true
|
|
|
|
@debug map.has-key($font-weights, "bolder"); // false
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.has-key($font-weights, "regular") // true
|
|
|
|
@debug map.has-key($font-weights, "bolder") // false
|
|
|
|
{% endcodeExample %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
---
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-03 00:02:34 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}
|
|
|
|
Only Dart Sass supports calling `map.has-key()` with more than two
|
|
|
|
arguments.
|
|
|
|
{% endcompatibility %}
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is not empty, follows the set of keys including `$key` and
|
|
|
|
excluding the last key in `$keys`, from left to right, to find the nested map
|
|
|
|
targeted for searching.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns true if the targeted map contains a value associated with the last key
|
|
|
|
in `$keys`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns false if it does not, or if any key in `$keys` is missing from a map
|
|
|
|
or references a value that is not a map.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-has-key-2', false %}
|
|
|
|
$fonts: (
|
|
|
|
"Helvetica": (
|
|
|
|
"weights": (
|
|
|
|
"regular": 400,
|
|
|
|
"medium": 500,
|
|
|
|
"bold": 700
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
@debug map.has-key($fonts, "Helvetica", "weights", "regular"); // true
|
|
|
|
@debug map.has-key($fonts, "Helvetica", "colors"); // false
|
|
|
|
===
|
|
|
|
$fonts: ("Helvetica": ("weights": ("regular": 400, "medium": 500, "bold": 700)))
|
|
|
|
|
|
|
|
@debug map.has-key($fonts, "Helvetica", "weights", "regular") // true
|
|
|
|
@debug map.has-key($fonts, "Helvetica", "colors") // false
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.keys($map)', 'map-keys($map)', 'returns:list' %}
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a comma-separated list of all the keys in `$map`.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
{% codeExample 'map-keys', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
@debug map.keys($font-weights); // "regular", "medium", "bold"
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
@debug map.keys($font-weights) // "regular", "medium", "bold"
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.merge($map1, $map2)', 'map-merge($map1, $map2)', 'map.merge($map1, $keys..., $map2)', 'map-merge($map1, $keys..., $map2)', 'returns:map' %}
|
2023-06-02 23:36:10 +02:00
|
|
|
{% headsUp %}
|
|
|
|
In practice, the actual arguments to `map.merge($map1, $keys..., $map2)` are
|
|
|
|
passed as `map.merge($map1, $args...)`. They are described here as `$map1,
|
|
|
|
$keys..., $map2` for explanation purposes only.
|
|
|
|
{% endheadsUp %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If no `$keys` are passed, returns a new map with all the keys and values from
|
|
|
|
both `$map1` and `$map2`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If both `$map1` and `$map2` have the same key, `$map2`'s value takes
|
|
|
|
precedence.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
All keys in the returned map that also appear in `$map1` have the same order
|
|
|
|
as in `$map1`. New keys from `$map2` appear at the end of the map.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-merge', false %}
|
|
|
|
$light-weights: ("lightest": 100, "light": 300);
|
|
|
|
$heavy-weights: ("medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.merge($light-weights, $heavy-weights);
|
|
|
|
// ("lightest": 100, "light": 300, "medium": 500, "bold": 700)
|
|
|
|
===
|
|
|
|
$light-weights: ("lightest": 100, "light": 300)
|
|
|
|
$heavy-weights: ("medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.merge($light-weights, $heavy-weights)
|
|
|
|
// ("lightest": 100, "light": 300, "medium": 500, "bold": 700)
|
|
|
|
{% endcodeExample %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
---
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-03 00:02:34 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}
|
|
|
|
Only Dart Sass supports calling `map.merge()` with more than two arguments.
|
|
|
|
{% endcompatibility %}
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` is not empty, follows the `$keys` to find the nested map targeted
|
|
|
|
for merging. If any key in `$keys` is missing from a map or references a value
|
|
|
|
that is not a map, sets the value at that key to an empty map.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a copy of `$map1` where the targeted map is replaced by a new map that
|
|
|
|
contains all the keys and values from both the targeted map and `$map2`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-merge-2', false %}
|
|
|
|
$fonts: (
|
|
|
|
"Helvetica": (
|
|
|
|
"weights": (
|
|
|
|
"lightest": 100,
|
|
|
|
"light": 300
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$heavy-weights: ("medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.merge($fonts, "Helvetica", "weights", $heavy-weights);
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights": (
|
|
|
|
// "lightest": 100,
|
|
|
|
// "light": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
===
|
|
|
|
$fonts: ("Helvetica": ("weights": ("lightest": 100, "light": 300)))
|
|
|
|
$heavy-weights: ("medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.merge($fonts, "Helvetica", "weights", $heavy-weights)
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights": (
|
|
|
|
// "lightest": 100,
|
|
|
|
// "light": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.remove($map, $keys...)', 'map-remove($map, $keys...)', 'returns:map' %}
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a copy of `$map` without any values associated with `$keys`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If a key in `$keys` doesn't have an associated value in `$map`, it's ignored.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-remove', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.remove($font-weights, "regular"); // ("medium": 500, "bold": 700)
|
|
|
|
@debug map.remove($font-weights, "regular", "bold"); // ("medium": 500)
|
|
|
|
@debug map.remove($font-weights, "bolder");
|
|
|
|
// ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.remove($font-weights, "regular") // ("medium": 500, "bold": 700)
|
|
|
|
@debug map.remove($font-weights, "regular", "bold") // ("medium": 500)
|
|
|
|
@debug map.remove($font-weights, "bolder")
|
|
|
|
// ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.set($map, $key, $value)', 'map.set($map, $keys..., $key, $value)', 'returns:map' %}
|
2023-06-02 23:36:10 +02:00
|
|
|
{% headsUp %}
|
|
|
|
In practice, the actual arguments to `map.set($map, $keys..., $key, $value)`
|
|
|
|
are passed as `map.set($map, $args...)`. They are described here as `$map,
|
|
|
|
$keys..., $key, $value` for explanation purposes only.
|
|
|
|
{% endheadsUp %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` are not passed, returns a copy of `$map` with the value at `$key`
|
|
|
|
set to `$value`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-set', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
|
|
|
|
|
|
|
@debug map.set($font-weights, "regular", 300);
|
|
|
|
// ("regular": 300, "medium": 500, "bold": 700)
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
|
|
|
|
|
|
|
@debug map.set($font-weights, "regular", 300)
|
|
|
|
// ("regular": 300, "medium": 500, "bold": 700)
|
|
|
|
{% endcodeExample %}
|
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
---
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-03 00:02:34 +02:00
|
|
|
{% compatibility 'dart: "1.27.0"', 'libsass: false', 'ruby: false' %}
|
|
|
|
Only Dart Sass supports calling `map.set()` with more than three arguments.
|
|
|
|
{% endcompatibility %}
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
If `$keys` are passed, follows the `$keys` to find the nested map targeted for
|
|
|
|
updating. If any key in `$keys` is missing from a map or references a value
|
|
|
|
that is not a map, sets the value at that key to an empty map.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a copy of `$map` with the targeted map's value at `$key` set to
|
|
|
|
`$value`.
|
2023-06-02 23:36:10 +02:00
|
|
|
|
|
|
|
{% codeExample 'map-set-2', false %}
|
|
|
|
$fonts: (
|
|
|
|
"Helvetica": (
|
|
|
|
"weights": (
|
|
|
|
"regular": 400,
|
|
|
|
"medium": 500,
|
|
|
|
"bold": 700
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
@debug map.set($fonts, "Helvetica", "weights", "regular", 300);
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights": (
|
|
|
|
// "regular": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
===
|
|
|
|
$fonts: ("Helvetica": ("weights": ("regular": 400, "medium": 500, "bold": 700)))
|
|
|
|
|
|
|
|
@debug map.set($fonts, "Helvetica", "weights", "regular", 300)
|
|
|
|
// (
|
|
|
|
// "Helvetica": (
|
|
|
|
// "weights": (
|
|
|
|
// "regular": 300,
|
|
|
|
// "medium": 500,
|
|
|
|
// "bold": 700
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|
|
|
|
|
|
|
|
{% function 'map.values($map)', 'map-values($map)', 'returns:list' %}
|
2023-06-22 20:28:43 +02:00
|
|
|
Returns a comma-separated list of all the values in `$map`.
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
{% codeExample 'map-values', false %}
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700);
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
@debug map.values($font-weights); // 400, 500, 700
|
|
|
|
===
|
|
|
|
$font-weights: ("regular": 400, "medium": 500, "bold": 700)
|
2023-05-29 19:39:35 +02:00
|
|
|
|
2023-06-02 23:36:10 +02:00
|
|
|
@debug map.values($font-weights) // 400, 500, 700
|
|
|
|
{% endcodeExample %}
|
2023-05-29 19:39:35 +02:00
|
|
|
{% endfunction %}
|