UNPKG

517 BJavaScriptView Raw
1import objectEntries from "../polyfills/objectEntries.mjs";
2
3/**
4 * Creates an object map with the same keys as `map` and values generated by
5 * running each value of `map` thru `fn`.
6 */
7export default function mapValue(map, fn) {
8 var result = Object.create(null);
9
10 for (var _i2 = 0, _objectEntries2 = objectEntries(map); _i2 < _objectEntries2.length; _i2++) {
11 var _ref2 = _objectEntries2[_i2];
12 var _key = _ref2[0];
13 var _value = _ref2[1];
14 result[_key] = fn(_value, _key);
15 }
16
17 return result;
18}