source: node_modules/es-toolkit/dist/compat/array/zipObject.d.mts

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.1 KB
RevLine 
[a762898]1/**
2 * Combines two arrays, one of property names and one of corresponding values, into a single object.
3 *
4 * @template T - The type of values in the values array
5 * @param {ArrayLike<PropertyKey>} props - An array of property names
6 * @param {ArrayLike<T>} values - An array of values corresponding to the property names
7 * @returns {Record<string, T>} A new object composed of the given property names and values
8 *
9 * @example
10 * const props = ['a', 'b', 'c'];
11 * const values = [1, 2, 3];
12 * zipObject(props, values);
13 * // => { a: 1, b: 2, c: 3 }
14 */
15declare function zipObject<T>(props: ArrayLike<PropertyKey>, values: ArrayLike<T>): Record<string, T>;
16/**
17 * Creates an object from an array of property names, with undefined values.
18 *
19 * @param {ArrayLike<PropertyKey>} [props] - An array of property names
20 * @returns {Record<string, undefined>} A new object with the given property names and undefined values
21 *
22 * @example
23 * const props = ['a', 'b', 'c'];
24 * zipObject(props);
25 * // => { a: undefined, b: undefined, c: undefined }
26 */
27declare function zipObject(props?: ArrayLike<PropertyKey>): Record<string, undefined>;
28
29export { zipObject };
Note: See TracBrowser for help on using the repository browser.