jsmodern
Version:
An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.
12 lines • 386 B
JavaScript
export const from = {
isStatic: true,
label: 'from',
fn: function setFrom(setEntry, mapFn) {
if (!Array.isArray(setEntry)) {
throw new TypeError(`Expect an array of Set elements`);
}
const entries = 'function' === typeof (mapFn) ? setEntry.map(mapFn) : setEntry;
return new Set(entries);
},
};
//# sourceMappingURL=from.js.map