File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3
3
/**
4
4
* @typedef valueGenerator
5
5
* @type {function }
6
- * @param {string } value The original array entry
7
- * @param {number } index The index of the array entry (starts at 0)
8
- * @returns {* }
6
+ * @param {string } value Original array entry
7
+ * @param {number } index Index of the array entry (starts at 0)
8
+ * @returns {* } Anything that will be the object entry value
9
9
*/
10
10
11
11
/**
12
12
* Converts an array to an object with static keys and customizable values
13
13
* @example
14
+ * import arrayToObjectKeys from "array-to-object-keys"
14
15
* arrayToObjectKeys(["a", "b"])
15
16
* // {a: null, b: null}
16
17
* @example
18
+ * import arrayToObjectKeys from "array-to-object-keys"
17
19
* arrayToObjectKeys(["a", "b"], "value")
18
20
* // {a: "value", b: "value"}
19
21
* @example
22
+ * import arrayToObjectKeys from "array-to-object-keys"
20
23
* arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`)
21
24
* // {a: "value for a #1", b: "value for b #2"}
22
25
* @param {string[] } array Keys for the generated object
You can’t perform that action at this time.
0 commit comments