jsmodern
Version:
An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.
12 lines • 446 B
JavaScript
export const from = {
isStatic: true,
label: 'from',
fn: function setFrom(mapEntries, mapFn) {
if (!Array.isArray(mapEntries)) {
throw new TypeError(`Invalid map entries. Each map entry in a list must be an array of key/ value pairs.`);
}
const entries = 'function' === typeof (mapFn) ? mapEntries.map(mapFn) : mapEntries;
return new Map(entries);
},
};
//# sourceMappingURL=from.js.map