swc/crates/swc_bundler/tests/.cache/deno/6aa66eeb2703c40acaa7e5a16c042c7f9d19b387.ts
2021-11-09 20:42:49 +09:00

18 lines
460 B
TypeScript

// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/mapValue.js
import objectEntries from '../polyfills/objectEntries.js';
/**
* Creates an object map with the same keys as `map` and values generated by
* running each value of `map` thru `fn`.
*/
export default function mapValue(map, fn) {
const result = Object.create(null);
for (const [key, value] of objectEntries(map)) {
result[key] = fn(value, key);
}
return result;
}