UNPKG

diginext-utils

Version:
18 lines 631 B
/** * Converts an array to an object using array values. * If the input is already an object, returns it as-is. * Each array element becomes a property with its index as the key. * * @template T - The type of values * @param value - The value to convert (array or object) * @returns An object representation * * @example * ```ts * toObject([1, 2, 3]); // { '0': 1, '1': 2, '2': 3 } * toObject(['a', 'b', 'c']); // { '0': 'a', '1': 'b', '2': 'c' } * toObject({ x: 1 }); // { x: 1 } * ``` */ export declare function toObject<T>(value: T[] | Record<string, T>): Record<string, T>; //# sourceMappingURL=toObject.d.ts.map