Skip to content

Commit dc1ba16

Browse files
committed
Improved documentation
Signed-off-by: Jaid <jaid.jsx@gmail.com>
1 parent f9d5d8c commit dc1ba16

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
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

0 commit comments

Comments
 (0)