(obj, path, idx, value)
| 24609 | |
| 24610 | { |
| 24611 | var copyWithSetImpl = function (obj, path, idx, value) { |
| 24612 | if (idx >= path.length) { |
| 24613 | return value; |
| 24614 | } |
| 24615 | |
| 24616 | var key = path[idx]; |
| 24617 | var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here |
| 24618 | |
| 24619 | updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value); |
| 24620 | return updated; |
| 24621 | }; |
| 24622 | |
| 24623 | var copyWithSet = function (obj, path, value) { |
| 24624 | return copyWithSetImpl(obj, path, 0, value); |