{"version":3,"sources":["../../src/functions/objectEntries/objectEntries.ts","../../src/functions/objectFromEntries/objectFromEntries.ts","../../src/functions/mapValues/mapValues.ts"],"names":[],"mappings":";AAEO,IAAM,gBAA8B,OAAO;;;ACF3C,IAAM,oBAAuC,OAAO;;;ACcpD,SAAS,UACd,QACA,gBACoB;AACpB,SAAO;AAAA,IACL,cAAc,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,MAC1C;AAAA,MACA,eAAe,OAAO,GAAG;AAAA,IAC3B,CAAC;AAAA,EACH;AACF","sourcesContent":["import { CastToString, KeysOfUnion } from '../../types';\n\nexport const objectEntries: ObjetEntries = Object.entries;\n\n/**\n * Returns an array of a given object's own enumerable string-keyed property [key, value] pairs, in the same order as that provided by a for...in loop. (The only important difference is that a for...in loop enumerates properties in the prototype chain as well.)\n * Same as `Object.entries()` but returns a typed array.\n * @param object An object whose enumerable own property [key, value] pairs are to be returned.\n * @returns An array of the given object's own enumerable string-keyed property [key, value] pairs.\n */\ntype ObjetEntries = <T extends object>(\n  object: T\n) => Array<[CastToString<KeysOfUnion<T>>, T[keyof T]]>;\n","export const objectFromEntries: ObjectFromEntries = Object.fromEntries;\n\n/**\n * Returns a new object from an iterable of key-value pairs.\n * Same as `Object.fromEntries()` but returns a typed object.\n * @param entries An iterable object that contains key-value entries.\n * @returns A new object from the given iterable of key-value pairs.\n * @example\n * ```ts\n * objectFromEntries([\n *   ['a', 1],\n *   ['b', 2],\n *   ['c', 3]\n * ]);\n * // { a: 1, b: 2, c: 3 }\n */\ntype ObjectFromEntries = <K extends PropertyKey, V>(\n  entries: Iterable<readonly [K, V]>\n) => Record<K, V>;\n","import { CastToString, KeysOfUnion } from '../../types';\nimport { objectEntries } from '../objectEntries';\nimport { objectFromEntries } from '../objectFromEntries';\n\n/**\n * Returns a new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function.\n * @param object The object to map.\n * @param mapperFunction The function used to map each value.\n * @returns A new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function.\n * @example\n * ```ts\n * mapValues({ a: 1, b: 2, c: 3 }, (value) => value * 2) // { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function mapValues<T extends object, V>(\n  object: T,\n  mapperFunction: (value: T[keyof T], key: CastToString<KeysOfUnion<T>>) => V\n): Record<keyof T, V> {\n  return objectFromEntries(\n    objectEntries(object).map(([key, value]) => [\n      key,\n      mapperFunction(value, key),\n    ])\n  ) as Record<keyof T, V>;\n}\n"]}