typedash
Version:
modern, type-safe collection of utility functions
13 lines (11 loc) • 384 B
text/typescript
/**
* Converts an array of strings to an object with the same values as keys and values.
* @param array The array to convert to an object.
* @returns An object with the same values as keys and values.
* @example
* ```ts
* toObject(['a', 'b']) // { a: 'a', b: 'b' }
* ```
*/
declare function toObject<T extends string>(array: readonly T[]): Record<T, T>;
export { toObject };