# MiniMap

#### extends [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)

## Constructor

```javascript
new MiniMap(data?: [ [key, value], [key, value] ])
```

## <mark style="color:red;">Import</mark>

{% tabs %}
{% tab title="Typescript / ESM" %}

<pre class="language-typescript" data-title="index.ts" data-line-numbers><code class="lang-typescript"><strong>import { MiniMap } from "lavalink-client";
</strong></code></pre>

{% endtab %}

{% tab title="JavaScript (cjs)" %}
{% code title="index.js" lineNumbers="true" %}

```javascript
const { MiniMap } = require("lavalink-client");
```

{% endcode %}
{% endtab %}
{% endtabs %}

## <mark style="color:red;">Overview</mark>

| Properties     | Methods (from Map)                                      | Methods (added)                                          |
| -------------- | ------------------------------------------------------- | -------------------------------------------------------- |
| [size](#.size) | [get](#.get-key-any)                                    | [toJSON](#.tojson)                                       |
|                | [set](#.set-key-any-value-any)                          | [filter](#.filter-fn-value-key-map-greater-than-boolean) |
|                | [has](#.has-key-any)                                    | [map](#.map-fn-value-key-map-greater-than-any)           |
|                | [delete](#.delete-key-any)                              |                                                          |
|                | [clear](#.clear)                                        |                                                          |
|                | [entries](#.entries)                                    |                                                          |
|                | [values](#.values)                                      |                                                          |
|                | [keys](#.keys)                                          |                                                          |
|                | [forEach](#.foreach-fn-value-key-map-greater-than-void) |                                                          |

***

## <mark style="color:blue;">Properties</mark>

### <mark style="color:blue;">.size</mark>

> *Returns the Amount of entries*

**Type**: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)

## <mark style="color:purple;">Methods</mark>

### <mark style="color:purple;">.get(key:</mark>any<mark style="color:purple;">)</mark>

> *Get a value of a key*

**Returns**: any

### <mark style="color:purple;">.set(key:</mark>any<mark style="color:purple;">, value:</mark>any<mark style="color:purple;">)</mark>

> *Sets a Value into a key, if Key already exists then it gets overridden*

**Returns**: value:any

### <mark style="color:purple;">.has(key:</mark>any<mark style="color:purple;">)</mark>

> *Checks if the key is existing or not*

**Returns**: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

### <mark style="color:purple;">.delete(key:</mark>any<mark style="color:purple;">)</mark>

> *Deletes a key, if available, if not available nothing will happen*

**Returns**: any

### <mark style="color:purple;">.clear(</mark><mark style="color:purple;">)</mark>

> *Clears the entire Map*

**Returns**: [void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void)

### <mark style="color:purple;">.entries(</mark><mark style="color:purple;">)</mark>

> *Get an iterator of all entries, if you want to put the entries into an array do this:*
>
> *\`\[...map.entries()]\`*

**Returns**: [IterableIterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols?retiredLocale=de)<\[Key,Value]>

### <mark style="color:purple;">.values()</mark>

> *Get an iterator of all values, if you want to put the entries into an array do this:*
>
> *\`\[...map.values()]\`*

**Returns**: [IterableIterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols?retiredLocale=de)<\[Value]>

### <mark style="color:purple;">.keys()</mark>

> *Get an iterator of all keys, if you want to put the entries into an array do this:*
>
> *\`\[...map.keys()]\`*

**Returns**: [IterableIterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols?retiredLocale=de)<\[Key]>

### <mark style="color:purple;">.forEach(fn:</mark>(value,key,map)=>[void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void)<mark style="color:purple;">)</mark>

> *Run a function upon every entry.*

**Returns**: [void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void)

## <mark style="color:red;">Extended Methods</mark>

### <mark style="color:red;">.map(fn</mark><mark style="color:purple;">:</mark>(value,key,map)=>any<mark style="color:red;">)</mark>

> *Run a function upon every entry.*

**Returns**: [void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void)

### <mark style="color:red;">.filter(fn</mark><mark style="color:purple;">:</mark>(value,key,map)=>[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)<mark style="color:red;">)</mark>

> *Identical to* [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), but returns a [MiniMap ](https://lc4.gitbook.io/lavalink-client/docs/other-utils-and-classes/minimap)instead of an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).

**Returns**: [MiniMap](https://lc4.gitbook.io/lavalink-client/docs/other-utils-and-classes/minimap)\<Key, Value>

### <mark style="color:red;">.toJSON(</mark><mark style="color:red;">)</mark>

> Returns the Map to a JSON like value, just executes [this.entries](#.entries) and formats is an array instead

**Returns**: \[Key, Value]\[]
