Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 490 Bytes

map.md

File metadata and controls

27 lines (18 loc) · 490 Bytes

Map

Map instance

map/is

Confirms if given object is a native map

const isMap = require("type/map/is");

isMap(new Map()); // true
isMap(new Set()); // false
isMap({}); // false

map/ensure

If given argument is a map, it is returned back. Otherwise TypeError is thrown.

const ensureMap = require("type/map/ensure");

const map = new Map();
ensureMap(map); // map
eensureMap({}); // Thrown TypeError: [object Object] is not a map