123456789 |
- export const tupleToRecord = <
- KeyType extends string | number | symbol,
- ValueType
- >(
- tuples: [KeyType, ValueType][]
- ): Record<KeyType, ValueType> =>
- tuples.length > 0
- ? (Object.assign as any)(...tuples.map(([key, val]) => ({ [key]: val })))
- : {}
|