> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/sass/map/map.set.md).

# map.set()

The `map.set()` function sets [`$allowed`](#usdallowed...) [`$value`](#usdvalue) under [`$key`](#usdkey).

{% hint style="info" %}
Original sass `map.set()` function modified, by adding [`$allowed...`](https://docs.angular-package.dev/sass/map/pages/eA1D2RSFMwcOSbBuLIN8#usdallowed...) arbitrary argument to check if [`$value`](#usdvalue) is allowed to be set.
{% endhint %}

{% code lineNumbers="true" %}

```scss
// 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;
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/sass/blob/main/map/_map.set.function.scss>" %}

### Parameters

#### `$map`

A map to set [`$value`](#usdvalue) at [`$key`](#usdkey).

#### `$key`

A key under which [`$value`](#usdvalue) is set.

#### `$value`

The value to set in [`$map`](#usdmap) under [`$key`](#usdkey).

#### `$allowed...`

Allowed value types and/or values to set in [`$map`](#usdmap).

### Return

The return value is updated [`$map`](#usdmap) with [`$value`](#usdvalue) at [`$key`](#usdkey).

## Examples

```scss
// Use.
@use '@angular-package/sass/map';

// Examples.
@debug map.set((), ((test, 1),), 2222); // ((test, 1): 2222)
@debug map.set((), (test 1, (test, 2)), 2222); // (test 1: ((test, 2): 2222))

// single type
@debug map.set((a: 1, b: 2), test string, 27, string ); // (a: 1, b: 2)
@debug map.set((a: 1, b: 2), test number, 27, number); // (a: 1, b: 2, test: (number: 27))
@debug map.set((a: 1, b: 2), test map, (map: 22,), map); // (a: 1, b: 2, test: (map: (map: 22)))
@debug map.set((a: 1, b: 2), test list, (22, 44), list); // (a: 1, b: 2, test: (list: (22, 44)))
@debug map.set((a: 1, b: 2), test color, #ffffff, color); // (a: 1, b: 2, test: (color: #ffffff))
@debug map.set((a: 1, b: 2), test null, null, null); // (a: 1, b: 2, test: (null: null))

// multiple types
@debug map.set((a: 1, b: 2), test number, 27, number, string, bool, list, map); // (a: 1, b: 2, test: (number: 27))
@debug map.set((a: 1, b: 2), test string, twenty seven, number, string, bool, list, map); // (a: 1, b: 2, test: (string: twenty seven))
@debug map.set((a: 1, b: 2), test bool, false, number, string, bool, list, map); // (a: 1, b: 2, test: (bool: false))
@debug map.set((a: 1, b: 2), test null, null, number, null, string, bool, list, map); // (a: 1, b: 2, test: (null: null))

```
