map.set()

The map.set() function sets $allowed $value under $key.

Original sass map.set() function modified, by adding $allowed... arbitrary argument to check if $value is allowed to be set.

// Sass.
@use 'sass:list';
@use 'sass:map';
@use 'sass:meta';

// The `map.set()` function.
@function update($map, $key-value, $allowed...) {
  @each $key, $value in $key-value {
    $map: set($map, $key, $value, $allowed...);
  }
  @return $map;
}
https://github.com/angular-package/sass/blob/main/map/_map.set.function.scss

Parameters

$map

A map to set $value at $key.

$key

A key under which $value is set.

$value

The value to set in $map under $key.

$allowed...

Allowed value types and/or values to set in $map.

Return

The return value is updated $map with $value at $key.

Examples

Last updated

Was this helpful?