How to use the util._extend function in util

To help you get started, we’ve selected a few util 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 keymetrics / app-playground / node_modules / pmx / lib / index.js View on Github external
PMX.initModule = function(opts, cb) {
  if (!opts) opts = {};

  opts = util._extend({
    alert_enabled    : true,
    widget           : {}
  }, opts);

  opts.widget = util._extend({
    type : 'generic',
    logo : 'https://app.keymetrics.io/img/logo/keymetrics-300.png',
    theme            : ['#111111', '#1B2228', '#807C7C', '#807C7C']
  }, opts.widget);

  opts.isModule = true;
  opts = Configuration.init(opts);

  // Force error catching
  PMX.catchAll();
github Tjatse / node-readability / index.js View on Github external
options = { uri: uri }
  } else {
    options = uri
  }

  if (typeof options !== 'object') {
    return catchError('options are required!', reject)
  }

  uri = options.cheerio || options.html || options.uri

  if ((typeof uri !== 'string' && !isCheerio(uri)) || !uri) {
    return catchError('only accept cheerio, url or HTML as article content.', reject)
  }

  options = util._extend({
    killBreaks: true,
    lowerCaseTags: true,
    output: 'html',
    minTextLength: 25,
    thresholdLinkDensity: 0.25,
    minRelatedDensity: 0.8,
    minParagraphs: 3,
    scoreImg: false
  }, options)

  var density = options.thresholdLinkDensity
  // fixed boolean
  if (!isNaN(density)) {
    density = parseFloat(density)
  }
  if (isNaN(density) || (density > 1 || density < 0)) {
github zendesk / ipcluster / lib / workerwrapper.js View on Github external
function WorkerWrapper(pid, options) {
	events.EventEmitter.call(this);

	this.options = util._extend(util._extend({}, default_options), options);

	this.pid = pid;
	this.state = 'STARTING';
	this.connected = false;
	this.connect_timeout_TID = null;
	this.command_queue = [];

	this.timeout = false;
	this.dying   = false;

	// fake stats at initialization
	this.stats = {
		ts_sent:     +new Date(),
		ts_received: +new Date(),
		t_travel:    0,
		t_ping_diff: 0,
github brunch / auto-reload-brunch / test / index.js View on Github external
it('should not start an HTTPS server', () => {
          const plugin = subject(extend(sslOptions, {enabled: false}));
          expect(plugin.ssl).to.be.true;
          expect(plugin.httpsServer).to.be.undefined;
        });
      });
github ronwe / hornbill / frame / base / controller.js View on Github external
function writeRes (req , res , opt , status , body, header , debugStr){		
	if (res.headersSent){
		return console.log('header had been send' ,null , new Date, debugStr || '')
	}
	try{
		header = require('util')._extend(header || {}, res.getHeaders())	
		sendToRender(req , res , opt, {
			'status' : status,
			'header' : header || {'Content-Type': 'text/plain','Cache-Control': 'no-cache,no-store' ,  'service' :ServerHead },
			'body' :body 
		})
		
		/*
		res.writeHead( status, header || {'Content-Type': 'text/plain','Cache-Control': 'no-cache,no-store' ,  'service' :ServerHead })
		res.write( body)
		res.end()
		*/
	}catch(err){
		console.log('write res error' ,err , new Date, debugStr || '')
	}

}
github bigbluebutton / bigbluebutton / bigbluebutton-html5 / client / services.js View on Github external
localeFound = true;
                langOnly = true;
              },
              error: function (result) {
                alert("Error: Locale not found, Using Default");
              },
          });
       },
   });
   attempted = true;
  }
  */

  //var combined = extend(defaultMsgs, pt_BR);

  var combined = extend(defaultMsgs, newMessages);

  let results = [];
  if (langOnly) {
    results = [lang, combined];
  }else if (langRegionOnly) {
    results = [langRegion, combined];
  }else {
    results = [defaultLocale, combined];
  }

  return results;
}
github cedricdelpoux / react-google-map / node_modules / eslint-plugin-react / lib / rules / sort-comp.js View on Github external
function getMethodsOrder(defaultConfig, userConfig) {
  userConfig = userConfig || {};

  var groups = util._extend(defaultConfig.groups, userConfig.groups);
  var order = userConfig.order || defaultConfig.order;

  var config = [];
  var entry;
  for (var i = 0, j = order.length; i < j; i++) {
    entry = order[i];
    if (groups.hasOwnProperty(entry)) {
      config = config.concat(groups[entry]);
    } else {
      config.push(entry);
    }
  }

  return config;
}
github erelsgl / limdu / classifiers / multilabel / CrossLangaugeModelClassifier.js View on Github external
if (!Array.isArray(labels))  labels = [labels];
		var features = {};
		for (var i in labels) {
			var label = labels[i];
			var labelString = multilabelutils.stringifyIfNeeded(label);
			var labelFeatures = {};
			if (this.labelFeatureExtractor) {
				this.labelFeatureExtractor(label, labelFeatures);
			} else if (_.isObject(label)) {
				labelFeatures = label;
			} else {
				labelFeatures[label] = true;
			}
			this.allLabels[labelString] = label;
			this.allLabelsFeatures[labelString] = labelFeatures;
			features = util._extend(features, labelFeatures);
		}
		return features;
	},
github MitocGroup / deep-framework / src / deep-search / lib / Search.js View on Github external
this.kernel.loadAsyncConfig((asyncConfig) => {
      if (asyncConfig && asyncConfig.searchDomains && asyncConfig.searchDomains.hasOwnProperty(domainName)) {
        let client = null;
        domainConfig = util._extend(domainConfig, asyncConfig.searchDomains[domainName]);

        if (!domainConfig.hasOwnProperty('url')) {
          callback(new NotReadySearchDomainException(domainConfig.name, domainConfig.type));
          return;
        }

        if (domainConfig.type === Core.AWS.Service.ELASTIC_SEARCH) {
          client = new ElasticSearchClient(
            domainConfig.url, this.clientDecorator, !this.localBackend, domainConfig.version
          );
        }

        if (!client) {
          callback(new MissingSearchClientException(domainConfig.name, domainConfig.type));
          return;
        }
github mozilla / fxa / packages / fxa-auth-db-mysql / lib / db / mem.js View on Github external
function filterAccount(account) {
    var item = extend({}, account);
    delete item.verifyHash;

    item.profileChangedAt =
      item.profileChangedAt || item.verifierSetAt || item.createdAt;
    item.keysChangedAt =
      item.keysChangedAt || item.verifierSetAt || item.createdAt;

    return P.resolve(item);
  }