How to use the lodash.merge function in lodash

To help you get started, we’ve selected a few lodash 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 outlandishideas / kasia / test / connect / connectWpPost.js View on Github external
it('should render post title', () => {
      const query = { complete: true, OK: true, entities: [postJson.id] }
      state = merge({}, stateMultipleEntities, { wordpress: { queries: { 0: query } } })
      rendered.update() // Fake store update from completed request
      expect(rendered.html()).toEqual('<div>Architecto enim omnis repellendus</div>')
    })
  })
github patternplate / patternplate / packages / server / source / application / tasks / build-bundles / index.js View on Github external
return (
            includePatterns.some(pattern => minimatch(id, pattern)) &&
            !excludePatterns
              .concat("@environments/**/*")
              .some(pattern => minimatch(id, pattern))
          );
        });

        if (!includedPatterns.length) {
          application.log.warn(
            `No patterns to read for environment ${environment.name}. Check the .includes key of the environment configuration.`
          );
        }

        // Merge environment config into transform config
        const config = merge(
          {},
          {
            patterns: settings.patterns,
            transforms: settings.transforms
          },
          envConfig,
          {
            environments: [environment.name]
          }
        );

        const filters = merge({}, settings.filters, {
          inFormats: formats,
          environments: [environment.name]
        });
github jhildenbiddle / canvas-size / rollup.config.js View on Github external
},
    plugins: [
        resolve(),
        commonjs(),
        json(),
        eslint(pluginSettings.eslint)
    ],
    watch: {
        clearScreen: false
    }
};

// Formats
// -----------------------------------------------------------------------------
// ES Module
const esm = merge({}, config, {
    output: {
        file  : config.output.file.replace(/\.js$/, '.esm.js'),
        format: 'esm'
    },
    plugins: config.plugins.concat([
        babel(pluginSettings.babel.es6),
        terser(pluginSettings.terser.beautify)
    ])
});

// ES Module (Minified)
const esmMinified = merge({}, config, {
    output: {
        file  : esm.output.file.replace(/\.js$/, '.min.js'),
        format: esm.output.format
    },
github moxystudio / webpack-isomorphic-compiler / lib / reporter / index.js View on Github external
function getOptions(options) {
    return merge({
        humanErrors: true,  // Display human errors
        stats: true, // Display output assets, can be `true`, `false` and `once`
        statsOptions: {  // Stats object to use for stats.toString(),
            assets: true,
            chunks: false,
            version: false,
            children: false,
            modules: false,
            timings: false,
            hash: false,
            colors: chalk.enabled,
        },
        output: process.stderr,  // Writable stream to print stuff
    }, options);
}
github rubenspgcavalcante / webpack-chrome-extension-reloader / src / ChromeExtensionReloader.ts View on Github external
_registerPlugin(compiler: Compiler) {
    const { reloadPage, port, entries } = merge(defaultOptions, this._opts);

    this._eventAPI = new CompilerEventsFacade(compiler);
    this._injector = middlewareInjector(entries, { port, reloadPage });
    this._triggerer = changesTriggerer(port, reloadPage);
    this._eventAPI.afterOptimizeChunkAssets((comp, chunks) => {
      if (!compiler.options.entry || !compiler.options.entry["background"]) {
        throw new TypeError(bgScriptRequiredMsg.get());
      }
      comp.assets = {
        ...comp.assets,
        ...this._injector(comp.assets, chunks)
      };
    });
    this._eventAPI.afterEmit((comp, done) => {
      if (this._contentOrBgChanged(comp.chunks, entries)) {
        this._triggerer()
github public-accountability / oligrapher / app / stores / DeckStore.js View on Github external
addDeck(specs){
    const deck = specs.deck;
    this.setState({
      decks: _.merge(this.state.decks, { [deck.id]: deck })
    });
  }
github develomark / graphql-cli-generate-fragments / src / GenerateFragments.ts View on Github external
if (
      this.argv.project ||
      (!this.argv.project &&
        (has(this.project.config, "extensions.generate-fragments") ||
          has(this.project.config, "extensions.fragments")))
    ) {
      this.context.spinner.start(
        `Generating fragments for project ${this.projectDisplayName()}...`
      );
      fragmentsExtensionConfig = this.processFragments(
        this.fragmentsExtensionConfig
          ? this.fragmentsExtensionConfig["generate-fragments"]
          : undefined
      );
      merge(this.project.extensions, fragmentsExtensionConfig);
      this.context.spinner.succeed(
        `Fragments for project ${this.projectDisplayName()} written to ${chalk.green(
          fragmentsExtensionConfig["generate-fragments"].output
        )}`
      );
    } else if (this.argv.verbose) {
      this.context.spinner.info(
        `Generate Fragments not configured for project ${this.projectDisplayName()}. Skipping`
      );
    }
  }
github lykmapipo / mongoose-rest-actions / lib / http / middlewares / update.js View on Github external
function middleware(request, response, next) {

    //2.1.0...obtain request params and query parameters
    const params = _.merge({}, request.params);
    const query = _.merge({}, request.query);

    //2.1.1...obtain request body
    const body = _.merge({}, request.body);

    //2.1.2...obtain resource _id
    const _id = (params.id || params._id) || (query.id || query._id);

    //TODO pass edit options

    //2.1.3...create resource(s)
    findAndUpdate(_id, body, function afterUpdate(error, results) {

      //2.2...handle error or not results
      if (error || !results) {
        //TODO notify error
        //TODO notify no results

        //ensure status
        error.status = error.status || 500;
github topcoder-platform / community-app / src / shared / components / ChallengeFilters / ChallengeFiltersExample.jsx View on Github external
onSearch(searchString, filter) {
    const f = new ChallengeFilterWithSearch();
    _.merge(f, filter);
    f.query = searchString;
    this.setState({ searchQuery: searchString }, () => this.onFilterByTopFilter(f));
  }