Skip to content

Commit d09fe0d

Browse files
committed
Added jsdoc annotation
1 parent c2864c1 commit d09fe0d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* Converts an array to an object with static keys and customizable values
3+
* @example
4+
* arrayToObjectKeys(["a", "b"])
5+
* // {a: null, b: null}
6+
* @example
7+
* arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`)
8+
* // {a: "value for a #1", b: "value for b #2"}
9+
* @param {Array} array
10+
* @param {function} function
11+
* @returns {Object} A generated object based on the array input
12+
*/
113
export default (array, valueGenerator = null) => {
214
if (!Array.isArray(array)) {
315
return {}

0 commit comments

Comments
 (0)