|
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 | type PropertyName = string | number | symbol;
|
|---|
| 2 | /**
|
|---|
| 3 | * Converts an array of key-value pairs into an object.
|
|---|
| 4 | *
|
|---|
| 5 | * @template T - The type of the values.
|
|---|
| 6 | * @param {ArrayLike<[PropertyName, T]> | null | undefined} pairs - An array of key-value pairs.
|
|---|
| 7 | * @returns {Record<string, T>} - An object where keys are strings and values are of type T.
|
|---|
| 8 | *
|
|---|
| 9 | * @example
|
|---|
| 10 | * const pairs = [['a', 1], ['b', 2]];
|
|---|
| 11 | * const result = fromPairs(pairs);
|
|---|
| 12 | * // => { a: 1, b: 2 }
|
|---|
| 13 | */
|
|---|
| 14 | declare function fromPairs<T>(pairs: ArrayLike<[PropertyName, T]> | null | undefined): Record<string, T>;
|
|---|
| 15 | /**
|
|---|
| 16 | * Converts an array of key-value pairs into an object.
|
|---|
| 17 | *
|
|---|
| 18 | * @param {ArrayLike<any[]> | null | undefined} pairs - An array of key-value pairs.
|
|---|
| 19 | * @returns {Record<string, any>} - An object where keys are strings and values can be any type.
|
|---|
| 20 | *
|
|---|
| 21 | * @example
|
|---|
| 22 | * const pairs = [['a', 1], ['b', 'hello']];
|
|---|
| 23 | * const result = fromPairs(pairs);
|
|---|
| 24 | * // => { a: 1, b: 'hello' }
|
|---|
| 25 | */
|
|---|
| 26 | declare function fromPairs(pairs: ArrayLike<any[]> | null | undefined): Record<string, any>;
|
|---|
| 27 |
|
|---|
| 28 | export { fromPairs };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.