@newdash/newdash
Version:
javascript/typescript utility library
33 lines (32 loc) • 872 B
TypeScript
import type { Values } from "./types";
/**
* Converts `value` to an array.
*
* @since 5.6.0
* @category Lang
* @param value The value to convert.
* @returns Returns the converted array.
* @example
*
* ```js
* toArray({ 'a': 1, 'b': 2 })
* // => [1, 2]
*
* toArray('abc')
* // => ['a', 'b', 'c']
*
* toArray(1)
* // => []
*
* toArray(null)
* // => []
* ```
*/
export declare function toArray(value: number): [];
export declare function toArray(value: ""): [];
export declare function toArray(value: null): [];
export declare function toArray(value: string): Array<string>;
export declare function toArray<T extends Map<any, any>>(value: T): ReturnType<T["entries"]>;
export declare function toArray<T extends Set<any>>(value: T): ReturnType<T["values"]>;
export declare function toArray<T extends object>(value: T): Values<T>;
export default toArray;