"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepSet_ = void 0;
const object_1 = require("./util/object");
function deepSet(obj, path, value) {
    let _obj = (0, object_1.clone)(obj);
    if (path.length > 0) {
        const [head, ...tail] = path;
        _obj[head] = deepSet(_obj[head] || {}, tail, value);
        return _obj;
    }
    else {
        return value;
    }
}
exports.default = deepSet;
function deepSet_(obj, path, value) {
    var _a;
    if (path.length > 1) {
        const [head, ...tail] = path;
        obj[head] = (_a = obj[head]) !== null && _a !== void 0 ? _a : {};
        deepSet_(obj[head], tail, value);
    }
    else {
        const [head] = path;
        obj[head] = value;
    }
}
exports.deepSet_ = deepSet_;
//# sourceMappingURL=deepSet.js.map