16 lines
346 B
JavaScript
16 lines
346 B
JavaScript
export const baseClass = class {};
|
|
|
|
export function fromEntries(entries) {
|
|
return entries.reduce((r, [k, v]) => ({...r, [k]: v}), {});
|
|
}
|
|
|
|
export function map(O, fn) {
|
|
const keys = Object.keys(O);
|
|
const result = {};
|
|
for (let i = 0; i < keys.length; i++) {
|
|
const key = keys[i];
|
|
result[key] = fn(O[key], key);
|
|
}
|
|
return result;
|
|
}
|