# map.remove()

The `map.remove()` function with unified `map.remove()` and `deep-remove()` returns [`$map`](#usdmap) without [`$keys`](#usdkeys...).

{% hint style="info" %}
Modified by adding deep remove on key as comma-separated list. This way of providing key is consistent with a [`map.set()`](https://docs.angular-package.dev/sass/map/map.set) and [`map.get()`](https://docs.angular-package.dev/sass/map/map.get) functions.
{% endhint %}

{% code lineNumbers="true" %}

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

// The `map.remove()` function.
@function remove($map, $keys...) {
  @each $key in $keys {
    $map: if(
      meta.type-of($key) == list and list.separator($key) == comma,
      map.deep-remove($map, $key...),
      map.remove($map, $key)
    );
  }
  @return $map;
}
```

{% endcode %}

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

### Parameters

#### `$map`

A map to remove [`$keys`](#usdkeys...) from.

#### `$keys...`

Multiple keys to remove from [`$map`](#usdmap). If key is a comma-separated list then `map.deep-remove()` function is used, otherwise `map.remove()`.

### Return

The return value is a copy of [`$map`](#usdmap) without any values associated with [`$keys`](#usdkeys...).

## Examples

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

// Examples.
$-fonts: (
  "Helvetica": (
    "weights": (
      "regular": 400,
      "medium": 500,
      "bold": 700
    )
  ),
  "regular": 400,
  "medium": 500,
  "bold": 700
);

// key - default feature `map.remove()` and `deep-remove()`.
@debug map.remove($-fonts, regular, (Helvetica, weights, medium)); // ("Helvetica": ("weights": ("regular": 400, "bold": 700)), "medium": 500, "bold": 700)

```
