# map.values()

The modified `map.values()` function returns all values or values of [`$keys`](#usdkeys...) from [`$map`](#usdmap).

{% hint style="info" %}
The modified `map.values()` function, by adding arbitrary parameter [`$keys...`](https://docs.angular-package.dev/sass/map/pages/OqdQOm2cXFfqhJEFHZCh#usdkeys...) to return values of the specified keys.
{% endhint %}

{% code lineNumbers="true" %}

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

// The `map.values()` function.
@function values($map, $keys...) {
  @if list.length($keys) > 0 {
    @for $i from 1 through list.length($keys) {
      $keys: if(
        map.has-key($map, list.nth($keys, $i)),
        list.set-nth($keys, $i, map.get($map, list.nth($keys, $i))),
        $keys
      );
    }
  } @else {
    $keys: map.values($map);
  }
  @return $keys;
}
```

{% endcode %}

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

### Parameters

#### `$map`

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

#### `$keys...`

The keys to retrieve values from [`$map`](#usdmap).

### Return

The return value is a comma-separated list of values retrieved from [`$map`](#usdmap).

## Examples

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

// Examples.
// key string
@debug map.values((a: 1, b: 2, c: 3), 'a', 'b', 'c'); // (1, 2, 3)

// different map order
@debug map.values((b: 2, a: 1, c: 3), 'a', 'b', 'c'); // (1, 2, 3)

// different map order + keys
@debug map.values((b: 2, a: 1, c: 3), 'c', 'b', 'a'); // (3, 2, 1)
@debug map.values((a: 1, b: 2, c: 3), 'b', 'c'); // (2, 3)

// key list
@debug map.values(((a, b): 1, b: 2, c: 3), 'a', (a, b), 'c'); // ("a", 1, 3)

// key map
@debug map.values((b: 2, (a: b): 1, c: 3), 'a', (a: b), 'c'); // ("a", 1, 3)

// default functionality
@debug map.values((a: 1, b: 2, c: 3)); // (1, 2, 3)

```


---

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