    import YMap from 'yjs/src/Types/YMap/YMap.js'

public class | source

# YMap

#### Extends:

Item → Type → YMap

#### Direct Subclass:

YXmlHook

A shared Map implementation.

## Method Summary

Public Methods
public | delete (key: encodable) Remove a specified element from this YMap. |
public | get (key: encodable): * Returns a specified element from this YMap. |
public | has (key: encodable): boolean Returns a boolean indicating whether the specified key exists or not. |
public | keys (): Array Returns the keys for each element in the YMap Type. |
public | set (key: encodable, value: encodable | YType): * Adds or updates an element with a specified key and value. |
public | toJSON (): Object Transforms this Shared Type to a JSON object. |

## Inherited Summary

From class Type
public | getPathTo (type: YType): Array<string> Compute the path from this type to the specified target. |
public | observe (f: Function) Observe all events that are created on this type. |
public | observeDeep (f: Function) Observe all events that are created by this type and its children. |
public | unobserve (f: Function) Unregister an observer function. |
public | unobserveDeep (f: Function) Unregister an observer function. |

## Public Methods

### public delete(key: encodable) source

Remove a specified element from this YMap.

#### Params:

Name | Type | Attribute | Description
key | encodable |  | The key of the element to remove.

### public get(key: encodable): * source

Returns a specified element from this YMap.

#### Params:

Name | Type | Attribute | Description
key | encodable |  | The key of the element to return.

#### Return:

*

### public has(key: encodable): boolean source

Returns a boolean indicating whether the specified key exists or not.

#### Params:

Name | Type | Attribute | Description
key | encodable |  | The key to test.

#### Return:

boolean

### public keys(): Array source

Returns the keys for each element in the YMap Type.

#### Return:

Array

### public set(key: encodable, value: encodable | YType): * source

Adds or updates an element with a specified key and value.

#### Params:

Name | Type | Attribute | Description
key | encodable |  | The key of the element to add to this YMap.
value | encodable | YType |  | The value of the element to add to this YMap.

#### Return:

*

### public toJSON(): Object source

Transforms this Shared Type to a JSON object.

#### Return:

Object