export const isObject = item => !!item && typeof item === 'object' && !Array.isArray(item);
export const deepMerge = (target, ...sources) => {
  if (!sources.length) {
    return target;
  }

  const source = sources.shift();

  if (source === undefined) {
    return target;
  }

  if (isObject(target) && isObject(source)) {
    Object.keys(source).forEach(key => {
      if (isObject(source[key])) {
        if (!target[key]) Object.assign(target, {
          [key]: {}
        });
        deepMerge(target[key], source[key]);
      } else {
        Object.assign(target, {
          [key]: source[key]
        });
      }
    });
  }

  return deepMerge(target, ...sources);
};
export function omit(target, fields) {
  return Object.keys(target).filter(key => !fields.includes(key)).reduce((acc, cur) => ({ ...acc,
    [cur]: target[cur]
  }), {});
}