feat: FromEntries

This commit is contained in:
cha0s 2020-06-19 15:29:42 -05:00
parent d9da7de6d0
commit 84affcbc64
2 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,7 @@ export {
export { export {
baseClass, baseClass,
map as mapObject, map as mapObject,
fromEntries as objectFromEntries,
} from './object'; } from './object';
export {PropertyMixin as Property} from './property'; export {PropertyMixin as Property} from './property';
export {TickingPromise} from './ticking-promise'; export {TickingPromise} from './ticking-promise';

View File

@ -1,5 +1,9 @@
export const baseClass = class {}; export const baseClass = class {};
export function fromEntries(entries) {
return entries.reduce((r, [k, v]) => ({...r, [k]: v}), {});
}
export function map(O, fn) { export function map(O, fn) {
const keys = Object.keys(O); const keys = Object.keys(O);
const result = {}; const result = {};