How to use deepmerge - 10 common examples

To help you get started, we’ve selected a few deepmerge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taskcluster / taskcluster / ui / src / views / Tasks / CreateTask / index.jsx View on Github external
makeInteractive(payload) {
    const task = merge(payload, {
      payload: {
        features: {
          interactive: true,
        },
      },
    });

    if (task.payload.caches) {
      delete task.payload.caches;
    }

    // Minimum of an hour
    task.payload.maxRunTime = Math.max(3600, task.payload.maxRunTime || 0);

    // Avoid side-effects
    if (task.routes) {
github haiwen / seahub / frontend / src / lib / seafile-markdown2html.js View on Github external
function stringify(config) {
  var settings = xtend(config, this.data('settings'));
  var schema = deepmerge(gh, {
    "attributes":{
      "input": [
        "type",
      ],
      "li": [
        "className"
      ],
    },
    "tagNames": [
      "input"
    ]
  });
  this.Compiler = compiler;

  function compiler(tree) {
    // use sanity to remove dangerous html, the default is
github ChainSafe / lodestar / packages / lodestar / src / cli / commands / dev.ts View on Github external
public async action(options: IDevCommandOptions, logger: ILogger): Promise {
    let conf: Partial = {};

    //find better place for this once this cli is refactored
    await initBLS();

    //merge config file
    if (options.configFile) {
      const parsedConfig = getTomlConfig(options.configFile, BeaconNodeOptions);
      //cli will override toml config options
      conf = deepmerge(conf, parsedConfig);
    }

    //override current config with cli config
    conf = deepmerge(conf, optionsToConfig(options, BeaconNodeOptions));

    if (options.resetDb) {
      const lodestarDir = "./" + options.db;
      if (fs.existsSync(lodestarDir)) {
        rmDir(lodestarDir);
      }
      if (options.validators && fs.existsSync("./validators")) {
        let start = 0, end = 0;
        if(options.validators.includes(",")) {
          const parts = options.validators.split(",");
          start = parseInt(parts[0]);
          end = parseInt(parts[1]);
        } else {
          end = parseInt(options.validators);
        }
        for (let i = start; i < end; i++) {
github neutrinojs / neutrino / packages / neutrino / src / api.js View on Github external
getOptions(opts = {}) {
    let moduleExtensions = new Set(['js', 'jsx', 'vue', 'ts', 'tsx', 'mjs']);
    const options = merge.all([
      {
        env: {
          NODE_ENV: 'development'
        },
        debug: false,
        quiet: false
      },
      opts.mains ? { mains: opts.mains } : { mains: { index: 'index' } },
      omit(['mains'], opts)
    ]);

    Object
      .keys(options.env)
      .forEach(env => process.env[env] = options.env[env]);

    pathOptions.forEach(([path, defaultValue, getNormalizeBase]) => {
github jxnblk / axs / src / parse-props.js View on Github external
const options = config.get()
  const _style = createUnderstyle(options)
  const filter = filterProps(options)

  const props = {}

  Object.keys(original)
    .forEach(key => {
      if (!filter(key) || AXS_PROPS.test(key)) return
      const value = original[key]
      props[key] = value
    })

  const propStyles = _style(original)

  const styles = merge.all([
    { margin: 0 },
    (original._css || {}),
    propStyles,
    (original.css || {}),
  ])

  const cxsClassName = cxs(styles)

  const className = classnames(original.className, cxsClassName)

  return { props, className }
}
github react-native-elements / react-native-elements / src / config / ThemeProvider.js View on Github external
this.setState(() => ({
      theme: deepmerge(this.defaultTheme, theme),
    }));
  };
github ProjectMirador / mirador / src / state / selectors / config.js View on Github external
  ({ theme, themes, selectedTheme }) => deepmerge(theme, themes[selectedTheme] || {}),
);
github KuangPF / vue-cli-analysis / packages / @vue / cli-ui / src / i18n.js View on Github external
export function mergeLocale (lang, messages) {
  const newData = deepmerge(i18n.getLocaleMessage(lang), messages)
  i18n.setLocaleMessage(lang, newData)
}
github deranjer / goTorrent / goTorrentWebUI / node_modules / material-ui / es / styles / getStylesCreator.js View on Github external
_Object$keys(overrides).forEach(key => {
      process.env.NODE_ENV !== "production" ? warning(stylesWithOverrides[key], ['Material-UI: you are trying to override a style that does not exist.', `Fix the \`${key}\` key of \`theme.overrides.${name}\`.`].join('\n')) : void 0;
      stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key], overrides[key]);
    });
github soanvig / jsr / src / modules / Renderer / index.js View on Github external
_createBody (start) {
    const structure = merge({}, this.bodyStructure);

    for (const moduleName in this.modules) {
      if (!this.modules[moduleName].view) {
        continue;
      }

      const view = this.modules[moduleName].view();
      view.forEach((singleView) => {
        structure[singleView.name] = singleView;
        if (!structure[singleView.parent].children) {
          structure[singleView.parent].children = [];
        }
        structure[singleView.parent].children.push(singleView.name);
      });
    }

deepmerge

A library for deep (recursive) merging of Javascript objects

MIT
Latest version published 2 years ago

Package Health Score

73 / 100
Full package analysis