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

Function parsePropPath

lib/helpers/formDataToJSON.js:12–20  ·  view source on GitHub ↗

* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] * * @param {string} name - The name of the property to get. * * @returns An array of strings.

(name)

Source from the content-addressed store, hash-verified

10 * @returns An array of strings.
11 */
12function parsePropPath(name) {
13 // foo[x][y][z]
14 // foo.x.y.z
15 // foo-x-y-z
16 // foo x y z
17 return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
18 return match[0] === '[]' ? '' : match[1] || match[0];
19 });
20}
21
22/**
23 * Convert an array to an object.

Callers 1

formDataToJSONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected