UNPKG

jsmodern

Version:

An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.

17 lines 596 B
export const from = { isStatic: true, label: 'from', fn: function weakMapFrom(mapEntries, mapFn) { if (!Array.isArray(mapEntries)) { throw new TypeError(`Invalid WeakMap entries. Each WeakMap entry must contain [key, value] where key must be an object`); } try { const entries = 'function' === typeof (mapFn) ? mapEntries.map(mapFn) : mapEntries; return new WeakMap(entries); } catch (_) { throw new TypeError(`WeakMap key must be an object`); } }, }; //# sourceMappingURL=from.js.map