Creates a new Immutable Map.
Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries.
Note: Map is a factory function and not a class, and does not use the
new keyword during construction.
const { Map } = require('immutable')
Map({ key: "value" })
Map([ [ "key", "value" ] ])
Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type.
let obj = { 1: "one" }
Object.keys(obj) // [ "1" ]
assert.equal(obj["1"], obj[1]) // "one" === "one"
let map = Map(obj)
assert.notEqual(map.get("1"), map.get(1)) // "one" !== undefined
Property access for JavaScript Objects first converts the key to a string,
but since Immutable Map keys can be of any type the argument to get() is
not altered.
Creates a new Immutable Map.
Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries.
Note: Map is a factory function and not a class, and does not use the
new keyword during construction.
const { Map } = require('immutable')
Map({ key: "value" })
Map([ [ "key", "value" ] ])
Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type.
let obj = { 1: "one" }
Object.keys(obj) // [ "1" ]
assert.equal(obj["1"], obj[1]) // "one" === "one"
let map = Map(obj)
assert.notEqual(map.get("1"), map.get(1)) // "one" !== undefined
Property access for JavaScript Objects first converts the key to a string,
but since Immutable Map keys can be of any type the argument to get() is
not altered.
Creates a new Immutable Map.
Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries.
Note: Map is a factory function and not a class, and does not use the
new keyword during construction.
const { Map } = require('immutable')
Map({ key: "value" })
Map([ [ "key", "value" ] ])
Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type.
let obj = { 1: "one" }
Object.keys(obj) // [ "1" ]
assert.equal(obj["1"], obj[1]) // "one" === "one"
let map = Map(obj)
assert.notEqual(map.get("1"), map.get(1)) // "one" !== undefined
Property access for JavaScript Objects first converts the key to a string,
but since Immutable Map keys can be of any type the argument to get() is
not altered.
Creates a new Immutable Map.
Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries.
Note: Map is a factory function and not a class, and does not use the
new keyword during construction.
const { Map } = require('immutable')
Map({ key: "value" })
Map([ [ "key", "value" ] ])
Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type.
let obj = { 1: "one" }
Object.keys(obj) // [ "1" ]
assert.equal(obj["1"], obj[1]) // "one" === "one"
let map = Map(obj)
assert.notEqual(map.get("1"), map.get(1)) // "one" !== undefined
Property access for JavaScript Objects first converts the key to a string,
but since Immutable Map keys can be of any type the argument to get() is
not altered.
Creates a new Immutable Map.
Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries.
Note:
Mapis a factory function and not a class, and does not use thenewkeyword during construction.Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type.
Property access for JavaScript Objects first converts the key to a string, but since Immutable Map keys can be of any type the argument to
get()is not altered.