MCPcopy Create free account
hub / github.com/axios/axios / arrayToObject

Function arrayToObject

lib/helpers/formDataToJSON.js:29–40  ·  view source on GitHub ↗

* Convert an array to an object. * * @param {Array } arr - The array to convert to an object. * * @returns An object with the same keys and values as the array.

(arr)

Source from the content-addressed store, hash-verified

27 * @returns An object with the same keys and values as the array.
28 */
29function arrayToObject(arr) {
30 const obj = {};
31 const keys = Object.keys(arr);
32 let i;
33 const len = keys.length;
34 let key;
35 for (i = 0; i < len; i++) {
36 key = keys[i];
37 obj[key] = arr[key];
38 }
39 return obj;
40}
41
42/**
43 * It takes a FormData object and returns a JavaScript object

Callers 1

buildPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected