{
  "version": 3,
  "sources": ["../../src/jsutils/keyValMap.ts"],
  "sourcesContent": ["import type { ObjMap } from \"./ObjMap\";\n\n/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * and a function to produce the values from each item in the array.\n *\n *     const phoneBook = [\n *       { name: 'Jon', num: '555-1234' },\n *       { name: 'Jenny', num: '867-5309' }\n *     ]\n *\n *     // { Jon: '555-1234', Jenny: '867-5309' }\n *     const phonesByName = keyValMap(\n *       phoneBook,\n *       entry => entry.name,\n *       entry => entry.num\n *     )\n *\n */\nexport function keyValMap<T, V>(\n  list: ReadonlyArray<T>,\n  keyFn: (item: T) => string,\n  valFn: (item: T) => V,\n): ObjMap<V> {\n  const result = Object.create(null);\n  for (const item of list) {\n    result[keyFn(item)] = valFn(item);\n  }\n  return result;\n}\n"],
  "mappings": ";AAmBO,SAAS,UACd,MACA,OACA,OACW;AACX,QAAM,SAAS,uBAAO,OAAO,IAAI;AACjC,aAAW,QAAQ,MAAM;AACvB,WAAO,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI;AAAA,EAClC;AACA,SAAO;AACT;",
  "names": []
}
