MCPcopy
hub / github.com/axios/axios / arrayToObject

Function arrayToObject

lib/helpers/formDataToJSON.js:49–60  ·  view source on GitHub ↗

* Convert an array to an object. * * @param {Array<any>} 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

47 * @returns An object with the same keys and values as the array.
48 */
49function arrayToObject(arr) {
50 const obj = {};
51 const keys = Object.keys(arr);
52 let i;
53 const len = keys.length;
54 let key;
55 for (i = 0; i < len; i++) {
56 key = keys[i];
57 obj[key] = arr[key];
58 }
59 return obj;
60}
61
62/**
63 * 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