Set a value for a path in a json-like structure
function deepSet(obj, path) {
    var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
    var define = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;

    if (!(0, _object.isObject)(obj)) throw new TypeError('Deepget is only supported for objects');
    var parts = interpolatePath(path);

    //  Build any unknown paths and set cursor
    for (var i = 0; i < parts.length - 1; i++) {
        //  If this part is an empty string, just continue
        if (parts[i] === '') continue;

        if (!obj[parts[i]]) obj[parts[i]] = {};

        //  Set cursor
        obj = obj[parts[i]];

        //  If not an array continue
        if (!(0, _array.isArray)(obj)) continue;

        //  If an array and i is not the last index ... set the object to be the index on the array
        if (i < parts.length - 2) {
            obj = obj[parts[i + 1]];
            i++;
        }
    }

    //  Set the actual value on the cursor
    define ? Object.defineProperty(obj, parts[parts.length - 1], value) : obj[parts[parts.length - 1]] = value;

    return !0;
}