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 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 */
1518export default ( array , valueGenerator = null ) => {
1619 if ( ! Array . isArray ( array ) ) {
You can’t perform that action at this time.
0 commit comments