(source, path, defaultValue = undefined)
| 224 | } |
| 225 | |
| 226 | lodash_get(source, path, defaultValue = undefined) { |
| 227 | const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') |
| 228 | let result = source |
| 229 | for (const p of paths) { |
| 230 | result = Object(result)[p] |
| 231 | if (result === undefined) { |
| 232 | return defaultValue |
| 233 | } |
| 234 | } |
| 235 | return result |
| 236 | } |
| 237 | |
| 238 | lodash_set(obj, path, value) { |
| 239 | if (Object(obj) !== obj) return obj |