Map

The Map object is a simple key/value map. Any value (both objects and primitive values) may be used as either a key or a value.

Kind: global class
See: Mozilla Map Documentation

map.size : number

The number of key/value pairs in the Map object.

Kind: instance property of Map
Example

let size = db.get('public.account').columns.size;

map.array : Array

Not part of Map standard. Values of Map as an array.

Kind: instance property of Map
Example

let schemasArray = db.schemas.array;

map.entries() ⇒ Iterator

Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.

Kind: instance method of Map
Example

let column = db.get('public.account').columns.get('name');

map.forEach(callbackFn, this)

Calls callbackFn once for each key-value pair present in the Map object, in insertion order. If a thisArg parameter is provided to forEach, it will be used as the this value for each callback.

Kind: instance method of Map

Param Type Description
callbackFn function Function to call for each pair.
this Object Context.

map.get(name) ⇒ *

Returns the value associated to the key, or undefined if there is none.

Kind: instance method of Map
Returns: * - - Value associated to key.

Param Type Description
name string Name of the item to get.

Example

let column = db.get('public.account').columns.get('name');

map.has(name) ⇒ boolean

Returns a boolean asserting whether a value has been associated to the key in the Map object or not.

Kind: instance method of Map
Returns: boolean - - true if key exists.

Param Type Description
name string Name of the item to test.

Example

let exists = db.schemas.has('public'); // true

map.keys() ⇒ Iterator

Returns a new Iterator object that contains the keys for each element in the Map object in insertion order.

Kind: instance method of Map
Example

for (let tableName of db.schemas.get('public').tables.keys()) {
    console.log(tableName);
}

let tableNames = Array.from(db.schemas.get('public').tables.keys()); // Table names as an array.

map.values() ⇒ Iterator

Returns a new Iterator object that contains the values for each element in the Map object in insertion order.

Kind: instance method of Map
Example

for (let table of db.schemas.get('public').tables.values()) {
    console.log(table.name);
}

let tables = Array.from(db.schemas.get('public').tables.values()); // Table objects as an array.