How to use the deepmerge.all function in deepmerge

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 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 JetBrains / svg-sprite-loader / lib / plugin.js View on Github external
constructor(cfg = {}) {
    const config = merge.all([defaultConfig, cfg]);
    this.config = config;

    const spriteFactoryOptions = {
      attrs: config.spriteAttrs
    };

    if (config.plainSprite) {
      spriteFactoryOptions.styles = false;
      spriteFactoryOptions.usages = false;
    }

    this.factory = ({ symbols }) => {
      const opts = merge.all([spriteFactoryOptions, { symbols }]);
      return spriteFactory(opts);
    };
github SkyJedi / RPG-Web-Character-Creator / src / data / talents / index.js View on Github external
import merge from 'deepmerge';
import {CRB} from './CRB'
import {ROT} from './ROT'

export const talents = merge.all([CRB, ROT]);
github akeneo / pim-community-dev / frontend / build / update-extensions.js View on Github external
function mergeExtensions(paths) {
    const config = paths.map(path => {
        return getFileContents(path) || {}
    })
    const merged = deepmerge.all(config)
    const mergedExtensions = Object.entries(merged.extensions).map(([code, extension]) => {
        return extensionConfig = {
            ...EXTENSION_DEFAULTS,
            ...extension,
            ...{ code }
        }
    })

    return {
        attribute_fields: merged.attribute_fields,
        extensions: mergedExtensions.sort((a, b) => {
            return a.position - b.position
        })
    }
}
github jonaskello / eslint-plugin-functional / src / configs / functional.ts View on Github external
import { all as deepMerge } from "deepmerge";

import currying from "./currying";
import noMutations from "./no-mutations";
import noExceptions from "./no-exceptions";
import noObjectOrientation from "./no-object-orientation";
import noStatements from "./no-statements";

import { Config } from "../util/misc";

const config: Config = deepMerge([
  currying,
  noMutations,
  noExceptions,
  noObjectOrientation,
  noStatements
]);

export default config;
github nuxt-community / sentry-module / lib / module.js View on Github external
},
    serverConfig: {},
    clientConfig: {},
    webpackConfig: {
      include: [],
      ignore: [
        'node_modules',
        '.nuxt/dist/client/img'
      ],
      urlPrefix: publicPath.startsWith('/') ? `~${publicPath}` : publicPath,
      configFile: '.sentryclirc'
    }
  }

  const topLevelOptions = this.options.sentry || {}
  const options = deepMerge.all([defaults, topLevelOptions, moduleOptions])

  options.serverConfig = deepMerge.all([options.config, options.serverConfig])
  options.clientConfig = deepMerge.all([options.config, options.clientConfig])

  if (!options.disableServerRelease) {
    options.webpackConfig.include.push(`${buildDirRelative}/dist/server`)
  }
  if (!options.disableClientRelease) {
    options.webpackConfig.include.push(`${buildDirRelative}/dist/client`)
  }

  if (options.config.release && !options.webpackConfig.release) {
    options.webpackConfig.release = options.config.release
  }

  const initializationRequired = options.initialize && options.dsn
github Limenius / liform-react / src / buildSyncValidation.js View on Github external
const findTypeInSchema = (schema, dataPath) => {
  if (!schema) {
    return;
  } else if (dataPath.length === 0 && schema.hasOwnProperty("type")) {
    return schema.type;
  } else {
    if (schema.type === "array") {
      return findTypeInSchema(schema.items, dataPath.slice(1));
    } else if (schema.hasOwnProperty("allOf")) {
      if (dataPath.length === 0) return "allOf";
      schema = { ...schema, ...merge.all(schema.allOf) };
      delete schema.allOf;
      return findTypeInSchema(schema, dataPath);
    } else if (schema.hasOwnProperty("oneOf")) {
      if (dataPath.length === 0) return "oneOf";
      schema.oneOf.forEach(item => {
        let type = findTypeInSchema(item, dataPath);
        if (type) {
          return type;
        }
      });
    } else {
      return findTypeInSchema(
        schema.properties[dataPath[0]],
        dataPath.slice(1)
      );
    }
github JetBrains / kotlin-playground / src / executable-code / executable-fragment.js View on Github external
sample = code.substring(startIndex + SAMPLE_START.length + 1, endIndex - 1);
      }

      if (this.suffix.endsWith('\n')) {
        this.suffix = this.suffix.substr(0, this.suffix.length - 1)
      }
    } else {
      if (this.state.folded) {
        sample = this.codemirror.getValue();
      } else {
        let editorValue = this.codemirror.getValue();
        sample = editorValue.substring(this.prefix.length, editorValue.length - this.suffix.length);
      }
    }

    this.state = merge.all([this.state, state, {
      isShouldBeFolded: this.isShouldBeFolded && state.isFoldedButton
    }]);

    super.update(this.state);
    if (!this.initialized) {
      this.initializeCodeMirror(state);
      this.initialized = true;
    } else {
      this.showDiagnostics(state.errors);
      if (state.folded === undefined) {
        return
      }
    }

    if (this.state.folded) {
      this.codemirror.setOption("lineNumbers", state.lines && !hasMarkers);
github san2beerelli / material-webcomponents / src / components / typography / mwc-typography.tsx View on Github external
componentWillLoad(){
    const typeStyle = new TypographyStyle();
    let changeStyle:object = {
      root:{
        display : this.display
      }
    }
    if(this.color){
      changeStyle[this.type] = {'color': this.color};
    }
    if(this.styles){
      if(changeStyle[this.type])
      {
       changeStyle[this.type] = deepmerge.all([changeStyle[this.type],this.styles])
      }else{
        changeStyle[this.type] = this.styles
      }
    }

    typeStyle.setup(changeStyle)
    let classNames: Array = []
    classNames.push('root')
    classNames.push(this.type)
    classNames.push(`align${this.align}`)
    if(this.nowrap){
      classNames.push('nowrap')
    }
    if(this.gutterbottom){
      classNames.push('gutterbottom')
    }

deepmerge

A library for deep (recursive) merging of Javascript objects

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis