source: node_modules/es-toolkit/dist/compat/util/toArray.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2 * Converts a record or null/undefined to an array of its values.
3 *
4 * @template T
5 * @param {Record<string, T> | Record<number, T> | null | undefined} value - The record or null/undefined to convert.
6 * @returns {T[]} Returns an array of the record's values or an empty array if null/undefined.
7 *
8 * @example
9 * toArray({ 'a': 1, 'b': 2 }) // => returns [1, 2]
10 * toArray(null) // => returns []
11 */
12declare function toArray<T>(value: Record<string, T> | Record<number, T> | null | undefined): T[];
13/**
14 * Converts a value to an array of its values.
15 *
16 * @template T
17 * @param {T} value - The value to convert.
18 * @returns {Array<T[keyof T]>} Returns an array of the value's values.
19 *
20 * @example
21 * toArray({ x: 10, y: 20 }) // => returns [10, 20]
22 * toArray('abc') // => returns ['a', 'b', 'c']
23 */
24declare function toArray<T>(value: T): Array<T[keyof T]>;
25/**
26 * Converts an undefined value to an empty array.
27 *
28 * @returns {any[]} Returns an empty array.
29 *
30 * @example
31 * toArray() // => returns []
32 */
33declare function toArray(): any[];
34
35export { toArray };
Note: See TracBrowser for help on using the repository browser.