Returns a Map from an object, or array of objects. Assumes the top-level properties of the object is the key.
import { Maps } from 'https://unpkg.com/ixfx/dist/data.js';const data = { Sally: { name: `Sally`, colour: `red` }, Bob: { name: `Bob`, colour: `pink` }};const map = Maps.fromObject(data);map.get(`Sally`); // { name: `Sally`, colour: `red` } Copy
import { Maps } from 'https://unpkg.com/ixfx/dist/data.js';const data = { Sally: { name: `Sally`, colour: `red` }, Bob: { name: `Bob`, colour: `pink` }};const map = Maps.fromObject(data);map.get(`Sally`); // { name: `Sally`, colour: `red` }
To add an object to an existing map, use addObject.
Returns a Map from an object, or array of objects. Assumes the top-level properties of the object is the key.
To add an object to an existing map, use addObject.