Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 857 Bytes

cid-map.md

File metadata and controls

34 lines (24 loc) · 857 Bytes

@module {Map} can-util/js/cid-map/cid-map cid-map @parent can-util/js

Exports the native Map or a polyfill.

@body

Use

This module exports the native Map object if Map is present. If not, a Map-like constructor function is exported that supports O(1) insertion and deletion by adding a [can-cid] property to objects passed to .set.

var Map = require("can-util/js/cid-map/cid-map");

var map = new Map();

var obj = {};

map.set(obj, "value");
map.get(obj) //-> "value";

The following methods and properties are supported by the polyfill:

  • clear()
  • delete(key)
  • forEach(callback[,thisArg])
  • get(key)
  • has(key)
  • set(key, value)
  • size