# map.pick()

The `map.pick()` function returns a copy of [`$map`](#usdmap) of [`$keys`](#usdkeys...).

{% code lineNumbers="true" %}

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

// Functions.
@use 'map.deep-merge.function' as *;
@use 'map.get.function' as *;
@use 'map.set.function' as *;

// Modules.
@use 'pattern';
@use 'pick';

// The `map.pick()` function.
@function pick($map, $keys...) {
  $result: ();
  @each $key in $keys {
    @if type-of($key) == list {
      $result: set(
        $result,
        if(
          list.separator($key) == space,
          ($key),
          if(list.length($key) > 1, list.nth($key, list.length($key)), $key)
        ),
        get($map, $key)
      );
    } @else if pattern.is($key) {
      $result: deep-merge($result, pick.pattern($map, $key...));
    } @else {
      $result: deep-merge(
        $result,
        (
          $key: get($map, $key),
        )
      );
    }
  }
  @return $result;
}
```

{% endcode %}

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

### Parameters

#### `$map`

A map from which values of [`$keys`](#usdkeys...) are taken.

#### `$keys...`

List of keys to get the values from [`$map`](#usdmap).

### Return

The return value is a copy of [`$map`](#usdmap) built of [`$keys`](#usdkeys...).

## Examples

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

// Examples.


```


---

# 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.pick.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.
