MCPcopy
hub / github.com/axios/axios / renderKey

Function renderKey

lib/helpers/toFormData.js:43–53  ·  view source on GitHub ↗

* It takes a path, a key, and a boolean, and returns a string * * @param {string} path - The path to the current key. * @param {string} key - The key of the current object being iterated over. * @param {string} dots - If true, the key will be rendered with dots instead of brackets. * * @return

(path, key, dots)

Source from the content-addressed store, hash-verified

41 * @returns {string} The path to the current key.
42 */
43function renderKey(path, key, dots) {
44 if (!path) return key;
45 return path
46 .concat(key)
47 .map(function each(token, i) {
48 // eslint-disable-next-line no-param-reassign
49 token = removeBrackets(token);
50 return !dots && i ? '[' + token + ']' : token;
51 })
52 .join(dots ? '.' : '');
53}
54
55/**
56 * If the array is an array and none of its elements are visitable, then it's a flat array.

Callers 1

defaultVisitorFunction · 0.85

Calls 2

removeBracketsFunction · 0.85
concatMethod · 0.80

Tested by

no test coverage detected