# 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

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/sass/map/map.has-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
