graphql
Version:
A Query Language and Runtime which can target any service.
1 lines • 899 B
Source Map (JSON)
{"version":3,"file":"mapValue.js","sourceRoot":"","sources":["../../src/jsutils/mapValue.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,QAAQ,CACtB,GAAsB,EACtB,EAAgC;IAEhC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEnC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { ObjMap, ReadOnlyObjMap } from './ObjMap.ts';\n\n/**\n * Creates an object map with the same keys as `map` and values generated by\n * running each value of `map` thru `fn`.\n *\n * @internal\n */\nexport function mapValue<T, V>(\n map: ReadOnlyObjMap<T>,\n fn: (value: T, key: string) => V,\n): ObjMap<V> {\n const result = Object.create(null);\n\n for (const key of Object.keys(map)) {\n result[key] = fn(map[key], key);\n }\n return result;\n}\n"]}