---
title: QidMap
summary: Class in @bimworks/jssdk.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/jssdk
---

# QidMap

[[page:reference/javascript/api|API catalogue]] · `@bimworks/jssdk` · Class

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
class QidMap<V>
````

QidMap represents a Set of mappings from Qid to some other object. It is like JavaScript Map, but specifically for keys of the Qid

### Type parameters

| Name | Constraint | Description |
|---|---|---|
| `V` | `` |  |

## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-constructor-d48be5cef39e|constructor]] | Method | Create a new QidMap |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-constructor-63f5e4e6f7be|constructor]] | Method | Create a new QidMap by providing an existing mapping |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-keys-83975e2dbbfe|keys]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-size-8996ea6d57e8|size]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-iterator-294d0d97919d|&#91;iterator&#93;]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-clear-ba6859fbe378|clear]] | Method | The clear() method of QidMap instances removes all Qid mappings from this map. |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-delete-6d038091e53c|delete]] | Method | The delete() method of QidMap instances removes the specified Qid mapping from this map by qid. |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-entries-0088272b1766|entries]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-foreach-5646a527d8ec|forEach]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-get-fdc11b320b8d|get]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-getbyvidoid-18cf471d851d|getByVidOid]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-has-86bbdeffc58f|has]] | Method | The has() method of QidMap instances returns a boolean indicating whether an element with the specified qid exists in this map or not. |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-set-70551c90b627|set]] | Method | The set() method of QidMap instances adds or updates an entry in this map with a specified Qid and a value. |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-setbyvidoid-69bffa688f6c|setByVidOid]] | Method | The setByVidOid() method of QidMap instances adds or updates an entry in this map with a specified Qid (given as Vid + Oid) and a value. This method should o… |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-union-d24253d58d4d|union]] | Method | Combine two QidMaps, when duplicate Qid entries exist in both QidMap, the values of other are used |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-unioninline-bff6f4fef52e|unionInline]] | Method | Combine two QidMaps, when duplicate Qid entries exist in both QidMap, the values of other are used |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-values-6ae191fc3f1d|values]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidmap-26297c7b#member-ofiterable-bc295668632e|ofIterable]] | Method |  |

## `constructor` {#member-constructor-d48be5cef39e}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
constructor()
````

Create a new QidMap

### Type parameters

| Name | Constraint | Description |
|---|---|---|
| `V` | `` |  |

## `constructor` {#member-constructor-63f5e4e6f7be}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
constructor(iterable: Iterable<[string | Qid | { oid: number; vid: string }, V]>)
````

Create a new QidMap by providing an existing mapping

### Type parameters

| Name | Constraint | Description |
|---|---|---|
| `V` | `` |  |

### Parameters

| Name | Type | Description |
|---|---|---|
| `iterable` | `Iterable<[string \| Qid \| { oid: number; vid: string }, V]>` |  |

## `keys` {#member-keys-83975e2dbbfe}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
keys(): Iterator<Qid, V, QidMap<V>>
````



## `size` {#member-size-8996ea6d57e8}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
size(): number
````



### Returns

The amount of mappings in this QidMap

## `[iterator]` {#member-iterator-294d0d97919d}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
[iterator](): IterableIterator<[Qid, V]>
````



## `clear` {#member-clear-ba6859fbe378}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
clear(): void
````

The clear() method of QidMap instances removes all Qid mappings from this map.

## `delete` {#member-delete-6d038091e53c}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
delete(qid: Qid): boolean
````

The delete() method of QidMap instances removes the specified Qid mapping from this map by qid.

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] |  |

## `entries` {#member-entries-0088272b1766}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
entries(): Iterator<Qid, V, QidMap<V>>
````



## `forEach` {#member-foreach-5646a527d8ec}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
forEach(callbackFn: (value: V, qid: Qid, set: QidSet) => boolean, thisArg?: unknown): void
````



### Parameters

| Name | Type | Description |
|---|---|---|
| `callbackFn` | `(value: V, qid: Qid, set: QidSet) => boolean` |  |
| `thisArg` | `unknown` |  |

## `get` {#member-get-fdc11b320b8d}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
get(qid: Qid): V
````



### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] | The Qid to get the value for |

### Returns

The linked object or null when there is no mapping for the Qid

## `getByVidOid` {#member-getbyvidoid-18cf471d851d}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
getByVidOid(vid: string, oid: number): V
````



### Parameters

| Name | Type | Description |
|---|---|---|
| `vid` | `string` |  |
| `oid` | `number` |  |

## `has` {#member-has-86bbdeffc58f}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
has(qid: Qid): boolean
````

The has() method of QidMap instances returns a boolean indicating whether an element with the specified qid exists in this map or not.

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] |  |

## `set` {#member-set-70551c90b627}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
set(qid: Qid, value: V): boolean
````

The set() method of QidMap instances adds or updates an entry in this map with a specified Qid and a value.

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] | The Qid for which to set the value |
| `value` | `V` | The value to set |

## `setByVidOid` {#member-setbyvidoid-69bffa688f6c}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
setByVidOid(vid: string, oid: number, value: V): boolean
````

The setByVidOid() method of QidMap instances adds or updates an entry in this map with a specified Qid (given as Vid + Oid) and a value.
This method should only be used when no Qid is available, and in those cases it will be slighly faster than first creating a Qid

### Parameters

| Name | Type | Description |
|---|---|---|
| `vid` | `string` | The Vid for which to set the value |
| `oid` | `number` | The Oid for which to set the value |
| `value` | `V` | The value to set |

## `union` {#member-union-d24253d58d4d}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
union(other: QidMap<V>): QidMap<V>
````

Combine two QidMaps, when duplicate Qid entries exist in both QidMap, the values of other are used

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | `QidMap<V>` |  |

### Returns

A new QidMap

## `unionInline` {#member-unioninline-bff6f4fef52e}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
unionInline(other: QidMap<V>): QidMap<V>
````

Combine two QidMaps, when duplicate Qid entries exist in both QidMap, the values of other are used

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | `QidMap<V>` |  |

### Returns

This QidMap, with the entries from other QidMap added (and overriding any keys of this)

## `values` {#member-values-6ae191fc3f1d}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
values(): Iterator<Qid, Qid, QidMap<V>>
````



## `ofIterable` {#member-ofiterable-bc295668632e}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
static ofIterable<V>(iterable: Iterable<[string | Qid | { oid: number; vid: string }, V]>): QidMap<V>
````



### Type parameters

| Name | Constraint | Description |
|---|---|---|
| `V` | `` |  |

### Parameters

| Name | Type | Description |
|---|---|---|
| `iterable` | `Iterable<[string \| Qid \| { oid: number; vid: string }, V]>` |  |
