Skip to content

Commit d34cf8f

Browse files
committed
Improved JSDoc annotations
1 parent 407857c commit d34cf8f

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
@@ -6,11 +6,14 @@
66
* arrayToObjectKeys(["a", "b"])
77
* // {a: null, b: null}
88
* @example
9+
* arrayToObjectKeys(["a", "b"], "value")
10+
* // {a: "value", b: "value"}
11+
* @example
912
* arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`)
1013
* // {a: "value for a #1", b: "value for b #2"}
11-
* @param {Array} array
12-
* @param {function} function
13-
* @returns {Object} A generated object based on the array input
14+
* @param {string[]} array Keys for the generated object
15+
* @param {function(value, index)|*} [valueGenerator] Optional function that sets the object values based on key and index
16+
* @returns {Object<string, *>} A generated object based on the array input
1417
*/
1518
export default (array, valueGenerator = null) => {
1619
if (!Array.isArray(array)) {

0 commit comments

Comments
 (0)