(path: (string | number)[])
| 13 | }; |
| 14 | |
| 15 | function validatePath(path: (string | number)[]) { |
| 16 | if (includes(path, '__proto__')) { |
| 17 | throw new Error('__proto__ is not allowed as a property'); |
| 18 | } |
| 19 | if (includes(path, 'prototype')) { |
| 20 | throw new Error('prototype is not allowed as a property'); |
| 21 | } |
| 22 | if (includes(path, 'constructor')) { |
| 23 | throw new Error('constructor is not allowed as a property'); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | export const getDeep = (object: object, path: (string | number)[]): object => { |
| 28 | validatePath(path); |