File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 33/**
44 * @typedef valueGenerator
55 * @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
99 */
1010
1111/**
1212 * Converts an array to an object with static keys and customizable values
1313 * @example
14+ * import arrayToObjectKeys from "array-to-object-keys"
1415 * arrayToObjectKeys(["a", "b"])
1516 * // {a: null, b: null}
1617 * @example
18+ * import arrayToObjectKeys from "array-to-object-keys"
1719 * arrayToObjectKeys(["a", "b"], "value")
1820 * // {a: "value", b: "value"}
1921 * @example
22+ * import arrayToObjectKeys from "array-to-object-keys"
2023 * arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`)
2124 * // {a: "value for a #1", b: "value for b #2"}
2225 * @param {string[] } array Keys for the generated object
You can’t perform that action at this time.
0 commit comments