* 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)
| 41 | * @returns {string} The path to the current key. |
| 42 | */ |
| 43 | function 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. |
no test coverage detected