(path)
| 137 | } |
| 138 | |
| 139 | function getPathSegments(path) { |
| 140 | const pathArray = path.split('.'); |
| 141 | const parts = []; |
| 142 | |
| 143 | for (let i = 0; i < pathArray.length; i++) { |
| 144 | let p = pathArray[i]; |
| 145 | |
| 146 | while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) { |
| 147 | p = p.slice(0, -1) + '.'; |
| 148 | p += pathArray[++i]; |
| 149 | } |
| 150 | |
| 151 | parts.push(p); |
| 152 | } |
| 153 | |
| 154 | return parts; |
| 155 | } |
| 156 | |
| 157 | // changed from https://github.com/sindresorhus/dot-prop/blob/master/index.js |
| 158 | export function getValue(object, path, defaultValue) { |