UNPKG

typedash

Version:

modern, type-safe collection of utility functions

1 lines 758 B
{"version":3,"file":"toObject-B6ADFSCh.cjs","names":["objectFromEntries"],"sources":["../src/functions/toObject/toObject.ts"],"sourcesContent":["import { objectFromEntries } from '../objectFromEntries';\n\n/**\n * Converts an array of strings to an object with the same values as keys and values.\n * @param array The array to convert to an object.\n * @returns An object with the same values as keys and values.\n * @example\n * ```ts\n * toObject(['a', 'b']) // { a: 'a', b: 'b' }\n * ```\n */\nexport function toObject<T extends string>(array: readonly T[]): Record<T, T> {\n return objectFromEntries(array.map((value) => [value, value]));\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,SAA2B,OAAmC;AAC5E,QAAOA,4CAAkB,MAAM,KAAK,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}