{ } qjs-modules

extendMap

Source: lib/extendMap.js (pure JS) — default export: extendMap

Installs extra (non-enumerable) methods onto Map.prototype.

Exports

ExportArgsKindDescription
extendMap(proto=Map.prototype)0–1functionInstalls the extensions. (default export)
MapExtensions—constThe bag of methods that get installed.
MapPrototype—constShortcut for Map.prototype.

Added Map.prototype methods

MethodDescription
getOrInsert(key, value)Returns the value for key, inserting value if absent.
getOrInsertComputed(key, fn)Like getOrInsert but computes the default via fn(key).