import { flatten, unflatten } from 'flat';
import _ from 'lodash';
export function flattenObjectSafe(obj, delimiter = '.') {
    return flatten(obj, { delimiter, safe: true });
}
export function flattenObject(obj, delimiter = '.') {
    return flatten(obj, { delimiter });
}
export function unflattenObject(obj, delimiter = '.') {
    return unflatten(obj, { delimiter });
}
export function unsetAll(obj, props) {
    props.forEach(path => {
        _.unset(obj, path);
    });
    return obj;
}
export function omitNested(obj, props) {
    const out = cloneOptions(obj);
    unsetAll(out, props);
    return out;
}
export function cloneOptions(x) {
    const y = {};
    Object.keys(x).forEach(name => {
        const value = x[name];
        if (_.isPlainObject(value)) {
            y[name] = cloneOptions(value);
        }
        else {
            y[name] = value;
        }
    });
    return y;
}
export function extend(x, y) {
    return _.merge({}, x, y);
}
//# sourceMappingURL=object.js.map