How to use the merge.recursive function in merge

To help you get started, we’ve selected a few merge 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 sasstools / sass-lint / lib / config.js View on Github external
// If it does then retrieve the value of it here or return false
  configMerge = configMergeExists ? config.options['merge-default-rules'] : false;

  // check to see if inline options contains an options property and whether property has a property called merge-default-rules
  optionsMergeExists = (options.options && typeof options.options['merge-default-rules'] !== 'undefined');

  // If it does then retrieve the value of it here or return false
  optionsMerge = optionsMergeExists ? options.options['merge-default-rules'] : false;


  // order of preference is inline options > user config > default config
  // merge-default-rules defaults to true so each step above should merge with the previous. If at any step merge-default-rules is set to
  // false it should skip that steps merge.
  defaults = confHelpers.loadDefaults();
  finalConfig = merge.recursive(defaults, config, options);

  // if merge-default-rules is set to false in user config file then we essentially skip the merging with default rules by overwriting our
  // final rules with the content of our user config otherwise we don't take action here as the default merging has already happened
  if (configMergeExists && !configMerge) {
    finalConfig.rules = config.rules;
  }

  // if merge-default-rules is set to false in inline options we essentially skip the merging with our current rules by overwriting our
  // final rules with the content of our user config otherwise we check to see if merge-default-rules is true OR that we have any inline
  // rules, if we do then we want to merge these into our final ruleset.
  if (optionsMergeExists && !optionsMerge) {
    finalConfig.rules = options.rules;
  }
  else if ((optionsMergeExists && optionsMerge) || options.rules && Object.keys(options.rules).length > 0) {
    finalConfig.rules = merge.recursive(finalConfig.rules, options.rules);
  }
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / config / index.js View on Github external
if (config.preset === undefined) {
		presetFile = require.resolve('liferay-npm-bundler-preset-standard');
	} else if (config.preset === '' || config.preset === false) {
		// don't load preset
	} else {
		presetFile = resolveModule.sync(config.preset, {
			basedir: '.',
		});
	}

	if (presetFile) {
		const originalConfig = Object.assign({}, config);
		Object.assign(
			config,
			merge.recursive(readJsonSync(presetFile), originalConfig)
		);
		config.pluginsBaseDir = getPackageDir(presetFile);
	}

	// Normalize
	config['/'] = config['/'] || {};
	config['config'] = config['config'] || {};
	config.packages = config.packages || {};
}
github matfish2 / vue-formular / lib / components / fields / textarea.js View on Github external
module.exports = function() {
  return merge.recursive(Field(), {
  props: {
    placeholder: {
      type:String,
      required:false,
      default:''
    },
    disabled: {
      type: Boolean
    },
    tinymce:{
      default: false
    },
    debounce:{
      type:Number,
      default:300
    },
github matfish2 / vue-form-2 / lib / index.js View on Github external
data: function() {
      return {
        globalOptions: globalOptions ? globalOptions : {},
        templates: merge.recursive(fields, customFields),
        isForm: true,
        vffields: [],
        additionalValues: [],
        vferrors: [],
        relatedFields: {},
        triggeredFields: {},
        sending: false
      };
    },
    computed: {
github matfish2 / vue-form-2 / lib / components / fields / buttons-list.js View on Github external
module.exports = function() {
  return merge.recursive(Field(), {
    data: function() {
      return {
        fieldType: "buttons",
        allSelected: false,
        filteringField: null,
        allSelected: false,
        clearText: "Clear",
        toggleTexts: {
          select: "Select All",
          unselect: "Unselect All"
        }
      };
    },
    props: {
      items: {
        type: Array,
github kaspernj / api_maker / npm-api-maker / src / collection.js View on Github external
_merge(object1, object2) {
    return merge.recursive(true, object1, object2)
  }
github matfish2 / vue-formular / lib / components / fields / textarea.js View on Github external
ready: function() {

    if (this.tinymce===false) return;

    var that = this;

    var setup = that.tinymce && that.tinymce.hasOwnProperty('setup')?
                that.tinymce.setup:
                function() {};

    var parentSetup = that.getForm().options.tinymceOptions.hasOwnProperty('setup')?
    that.getForm().options.tinymceOptions.setup:
    function(){};

    var options = typeof this.tinymce=='object'?
    merge.recursive(clone(this.getForm().options.tinymceOptions), this.tinymce):
    this.getForm().options.tinymceOptions;



    options = merge.recursive(options, {
      selector:'textarea[name=' + this.name +']',
      setup : function(ed) {

      that.editor = ed;
      parentSetup(ed);
      setup(ed);

        ed.on('change',function(e) {
          that.value = ed.getContent();
        }.bind(this));
github embark-framework / embark / src / lib / utils / utils.js View on Github external
function recursiveMerge(target, source) {
  const merge = require('merge');
  return merge.recursive(target, source);
}
github matfish2 / vue-form-2 / lib / components / fields / pikaday.js View on Github external
module.exports = function() {
  return merge.recursive(Field(), {
    props: {
      format: {
        type: String,
        default: "DD-MM-YYYY"
      },
      options: {
        type: Object
      }
    },
    data: function() {
      return {
        fieldType: "pikaday",
        months: {
          Jan: "01",
          Feb: "02",
          Mar: "03",
github matfish2 / vue-tables-2 / lib / v-client-table.js View on Github external
data: function() {
      return merge.recursive(
        data(),
        {
          source: "client",
          globalOptions,
          currentlySorting: {},
          time: Date.now()
        },
        stateData(useVuex, "client", this.options.initialPage)
      );
    },
    computed: {

merge

(recursive)? merging of (cloned)? objects.

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis