avocado-old/packages/core/object.js
2020-06-19 15:29:42 -05:00

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;
}