import { forEach } from './foreach';
import { extractKeys } from './object';
export function extendOnly(to, from, onlyKeys) {
    forEach(from, (key, value) => {
        to[key] = value;
    }, onlyKeys);
}
export function extendExcept(to, from, exceptKeys) {
    const onlyKeys = extractKeys(from, exceptKeys);
    return extendOnly(to, from, onlyKeys);
}
export function extendIfNoExists(to, from, onlyKeys) {
    forEach(from, (key, value) => {
        if (!to.hasOwnProperty(key)) {
            to[key] = value;
        }
    }, onlyKeys);
}
export function extend(to, ...froms) {
    Object.assign(to, ...froms);
    return to;
}
