export function isObject(obj) {
    return obj !== null && typeof obj === 'object';
}
export function deepGet(obj, path) {
    var parts = path.split('.');
    var length = parts.length;
    for (var i = 0; i < length; i++) {
        if (!isObject(obj))
            return undefined;
        obj = obj[parts[i]];
    }
    return obj;
}
export function deepSet(obj, path, value) {
    if (!isObject(obj))
        return obj;
    var root = obj;
    var parts = path.split('.');
    var length = parts.length;
    for (var i = 0; i < length; i++) {
        var p = parts[i];
        if (i === length - 1) {
            obj[p] = value;
        }
        else if (!isObject(obj[p])) {
            obj[p] = {};
        }
        obj = obj[p];
    }
    return root;
}
export function deepCopy(target) {
    var type = typeof target;
    if (target === null || type === 'boolean' || type === 'number' || type === 'string') {
        return target;
    }
    if (target instanceof Date) {
        return new Date(target.getTime());
    }
    if (Array.isArray(target)) {
        return target.map(function (o) { return deepCopy(o); });
    }
    if (typeof target === 'object') {
        var obj = {};
        for (var key in target) {
            obj[key] = deepCopy(target[key]);
        }
        return obj;
    }
    return undefined;
}
//# sourceMappingURL=object.js.map