{"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,UAAU,CAA4C,aAAkC,SAAY;AAC/G,QAAM,eAAe,YAAY,KAAK,IAAI;AAC1C,MAAI,iBAAiB,QAAW;AAC9B,gBAAY,KAAK,IAAI,IAAI,KAAK;AAC9B,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,iBAAa,KAAK,KAAK,KAAK;AAC5B,WAAO;AAAA,EACT;AAGA,cAAY,KAAK,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;AAClD,SAAO;AACT","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n  const currentValue = accumulator[pair.name];\n  if (currentValue === undefined) {\n    accumulator[pair.name] = pair.value;\n    return accumulator;\n  }\n\n  // If we already have it as array just push the value\n  if (Array.isArray(currentValue)) {\n    currentValue.push(pair.value);\n    return accumulator;\n  }\n\n  // convert to array since now we have more than one value for this key\n  accumulator[pair.name] = [currentValue, pair.value];\n  return accumulator;\n};\n"]}