(obj: any, path: PathType, value: any, opts: SetPathOpts)
| 95 | } |
| 96 | |
| 97 | function setPath(obj: any, path: PathType, value: any, opts: SetPathOpts) { |
| 98 | if (opts == null) { |
| 99 | opts = {}; |
| 100 | } |
| 101 | if (opts.remove && value != null) { |
| 102 | throw new Error("Cannot set value and remove at the same time"); |
| 103 | } |
| 104 | if (path == null) { |
| 105 | path = []; |
| 106 | } |
| 107 | if (!checkPath(path)) { |
| 108 | throw new Error("Invalid path: " + formatPath(path)); |
| 109 | } |
| 110 | return setPathInternal(obj, path, value, opts); |
| 111 | } |
| 112 | |
| 113 | function isEmpty(obj: any): boolean { |
| 114 | if (obj == null) { |
no test coverage detected