How to use the extend.js function in extend

To help you get started, we’ve selected a few extend 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 duojs / duo / lib / duo.js View on Github external
var gh = parse(dep);

  // We have all the information we need from `dep`.
  // Set the `package` key and return.
  if (gh.user && gh.repo && gh.ref) {
    gh.package = gh.user + '/' + gh.repo;
    return gh;
  }

  var dev = this.development();
  var deps = manifest.dependencies || {};
  var rext = /([\.][a-z]+)?/;

  // Include development dependencies if `development(true)` is set.
  if (dev && manifest === this.json) {
    deps = extend(deps, manifest.development || {});
  }

  // Build a regexp based on if we have the `user` key or not.
  // If we have the `user` key, our search is more specific.
  var re = gh.user
    ? new RegExp('^' + gh.user + '[\\/:]' + gh.repo + rext.source + '$', 'i')
    : new RegExp('([\\/:])' + gh.repo + rext.source + '$', 'i');

  // Not enough information yet.
  // Search through the manifest for our dependency.
  for (dep in deps) {
    if (re.test(dep) || dep.replace('/', '-') === gh.repo) {
      gh.package = dep;
      gh.ref = deps[dep];
      return gh;
    }
github qualitybath / bunyan-slack / lib / bunyan-slack.js View on Github external
try {
		message = self.customFormatter ? self.customFormatter(record, levelName) : {
			text: util.format('[%s] %s', levelName.toUpperCase(), record.msg)
		};
	} catch(err) {
		return self.error(err);
	}
	var base = {
		channel: self.channel,
		username: self.username,
		icon_url: self.icon_url,
		icon_emoji: self.icon_emoji
	};

	message = extend(base, message);

	request.post({
		url: self.webhook_url,
		body: JSON.stringify(message)
	})
	.on('error', function(err) {
		return self.error(err);
	});
};
github lapwinglabs / ive / index.js View on Github external
Ive.prototype.attr = function(key, rube) {
  if (!key) {
    return this.attrs;
  } else if ('ive' == key.name || 'object' == typeof key) {
    this.attrs = extend(this.attrs, key.attrs || key)
    return this;
  } else if (rube) {
    if (!this.attrs[key]) this.attrs[key] = Rube();
    this.attrs[key].use(rube);
    return this;
  } else {
    return this.attrs[key] || (this.attrs[key] = Rube());
  }
};
github tomcartwrightuk / socket.io-p2p / index.js View on Github external
function generateOffer () {
        var offerId = hat(160)
        var peerOpts = extend(opts, {initiator: true, trickle: true})
        var peer = self._peers[offerId] = new Peer(peerOpts)
        peer.setMaxListeners(50)
        self.setupPeerEvents(peer)
        peer.once('signal', function (offer) {
          offers.push({
            offer: offer,
            offerId: offerId
          })
          checkDone()
        })
      }
github MicroMinion / curvecp / src / packet-stream.js View on Github external
opts.logger = winston
  }
  this._log = winstonWrapper(opts.logger)
  this._log.addMeta({
    module: 'curvecp-packetstream'
  })
  opts.objectMode = false
  opts.decodeStrings = true
  opts.allowHalfOpen = false
  this.__ourNonceCounter = 0
  this.__remoteNonceCounter = 0
  this.__helloCounter = 0
  this.__state = null
  this.__sharedKey = null
  Duplex.call(this, opts)
  extend(this, {
    __canSend: false,
    __pendingWrite: null,
    __initiateSend: false,
    stream: null,
    isServer: false,
    serverName: new Uint8Array(256),
    clientExtension: new Uint8Array(16),
    serverExtension: new Uint8Array(16),
    serverPublicKey: null,
    serverPrivateKey: null,
    serverConnectionPublicKey: null,
    serverConnectionPrivateKey: null,
    clientPublicKey: null,
    clientPrivateKey: null,
    clientConnectionPublicKey: null,
    clientConnectionPrivateKey: null,
github matthewmueller / roo / lib / roo.js View on Github external
return function *() {
    var locals = this.locals || {};
    var params = this.params || {};
    locals = extend(params, locals);
    this.body = yield self.render(view, locals);
  }
};

extend

Port of jQuery.extend for node.js and the browser

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis