# map.has-keys()

The `map.has-keys()` function checks whether [`$map`](#usdmap) contains [`$keys`](#usdkeys...).

{% code lineNumbers="true" %}

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

// The `map.has-keys()` function.
@function has-keys($map, $keys...) {
  $has: ();
  @each $key in $keys {
    $has: list.append(
      $has,
      if(
        list.separator($key) == comma,
        map.has-key($map, $key...),
        map.has-key($map, $key)
      )
    );
  }
  @return if(list.index($has, false), false, true);
}
```

{% endcode %}

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

### Parameters

#### `$map`

A map to check whether it has all [`$keys`](#usdkeys...).

#### `$keys...`

The keys to check if [`$map`](#usdmap) contains them.

### Return

The return value is a `bool` indicating [`$map`](#usdmap) contains [`$keys`](#usdkeys...).

## Examples

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

// Examples.
$-map: (list1: (), list2: (), a b c d e f: value, a: (b: (c: (d: e))), any: true, all: false, separator: auto, bracketed: false, method: join, null: false);

// string key
@debug map.has-keys($-map, list1, list2); // true

// string keys
@debug map.has-keys($-map, list1, list2); // true
@debug map.has-keys($-map, list1, list2, wrong); // false
@debug map.has-keys($-map, list1, list3); // false

// list key
@debug map.has-keys($-map, a b c d e f); // true
@debug map.has-keys($-map, a b c d e); // false
@debug map.has-keys($-map, a b c d e f, bracketed); // true
@debug map.has-keys($-map, a b c d e, bracketed); // false

// nested keys
@debug map.has-keys($-map, (a, b, c, d), a b c d e f); // true
@debug map.has-keys($-map, (a, b, c, d), (a b c d e f g)); // false

```
