feat: mapObject
This commit is contained in:
parent
ada5754083
commit
8c876f7efb
|
@ -1,6 +1,14 @@
|
|||
export {arrayUnique, flatten, fromObject as arrayFromObject} from './array';
|
||||
export {
|
||||
arrayUnique,
|
||||
flatten,
|
||||
fromObject as arrayFromObject,
|
||||
shuffleInPlace
|
||||
} from './array';
|
||||
export {EventEmitterMixin as EventEmitter} from './event-emitter';
|
||||
export {inflate, deflate} from './flate';
|
||||
export {compose, fastApply} from './function';
|
||||
export {invoke as invokeHook, invokeFlat as invokeHookFlat} from './hook/registry';
|
||||
export {iterateForEach} from './iterator';
|
||||
export {merge} from './merge';
|
||||
export {
|
||||
mergeDiff,
|
||||
|
@ -8,9 +16,9 @@ export {
|
|||
mergeDiffObject,
|
||||
mergeDiffPrimitive,
|
||||
} from './merge-diff';
|
||||
export {inflate, deflate} from './flate';
|
||||
export {compose, fastApply} from './function';
|
||||
export {iterateForEach} from './iterator';
|
||||
export {
|
||||
map as mapObject,
|
||||
} from './object';
|
||||
export {PropertyMixin as Property} from './property';
|
||||
export {TickingPromise} from './ticking-promise';
|
||||
export {virtualize, virtualizeStatic} from './virtualize';
|
||||
|
|
9
packages/core/object.js
Normal file
9
packages/core/object.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
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]);
|
||||
}
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user