function Socket(url) { if (!url) { throw new Error('Please provide an url.'); } __.extend(this, Backbone.Events); this.url = url; this.connect(); }
loadTemplate('./js/templates/transactions.html', function(loadedTemplate) { self.$el.html( loadedTemplate( __.extend({}, self.model.toJSON(), { showUnpaid_purchases: localStorage.getItem('showUnpaid_purchases'), showUnpaid_sales: localStorage.getItem('showUnpaid_sales') }) ) ); self.setState(self.state); self.getData(); });
/** * @param {Object} options Actor options. * - {ActorSystem} system Actor system. * - {Actor|null} parent Actor parent or null, if it's a root actor. * - {String} namePrefix Name prefix for this actor. * - {String} mode Clustered actor mode. */ constructor(options) { super(_.extend(options, { namePrefix: options.namePrefix + 'RandomBalancer' })); }
(cfg.src.port === 443 ? https : http).get (cfg.src, function (response) { module.exports.writeRequestDataToFile (_.extend (_.pick (cfg, 'success', 'failure'), { request: response, filePath: cfg.dst })) })
News.findById(_id,function(err,news){ if(err) console.log(err); _news = _.extend(news, req.body) News.findByIdAndUpdate(_id,_news,function(error,wnews){ if(error) console.log(error); res.redirect('news/'+news._id) }) })
/* Makes { foo: true, bar: true } from ['foo', 'bar'] ======================================================================== */ _.withTest (['stdlib', 'index'], function () { $assert (_.index (['foo', 'bar']), { foo: true, bar: true }) }, function () { _.extend (_, { index: function (list) { var result = {} for (var i = 0, n = list.length; i < n; i++) { result[list[i]] = true } return result } }) })
parseProcessArgs (proposedKeys) { var args = process.argv.slice (2) var incomingKeys = _.intersection (args, _.map (proposedKeys, _.camelCaseToDashes)) var keysCamelCase = _.map (incomingKeys, _.dashesToCamelCase) return _.extend ( _.index (keysCamelCase), { keys: keysCamelCase, keysDashed: incomingKeys, all: args, values: _.without.apply (null, [args].concat (incomingKeys)) }) }
_.extend (def, { constructor: Meta.modify (def.hasOwnProperty ('constructor') ? def.constructor : this.defaultConstructor (base), function (fn) { if (base) { fn.prototype = Object.create (base.prototype); fn.prototype.constructor = fn } return fn }) })
function createRingpop(opts) { var ringpop = new Ringpop(_.extend({ app: 'test', hostPort: '127.0.0.1:3000' }, opts)); ringpop.isReady = true; return ringpop; }
_.extend (String, { randomHex: function (length) { if (length === undefined) { length = _.random (1, 32) } var string = ''; for (var i = 0; i < length; i++) { string += Math.floor (Math.random () * 16).toString (16) } return string }, leadingZero: function (n) { return (n < 10) ? '0' + n : n.toString () } })
loadTemplate('./js/templates/baseModal.html', function(t) { self.$el.html( t( __.extend({}, self.__options, { innerContent: self.el.innerHTML}) ) ); });
function ReferenceAuth(options, storage) { _.extend(this, new Base(options, storage)); this.authenticate = function(application, user_payload, callback) { user_payload = user_payload || {}; user_payload.id = user_payload.id || '' + _.random(1, 1000); callback(new Models.User(user_payload)); }; }
function TermList(params) { this.configs = _.extend(defaults, _.clone(params)); this.menu = new List(this.configs); this.items = []; this._header = ''; this._footer = ''; }
/** * construct */ constructor() { super(); this.data = _.extend({}, defaults); }
/** * Adds Idempotency-Key headers to the provided 'options' parameter * @param options * @param idempotencyKey */ withIdempotency(options, idempotencyKey) { return _.extend(options, { headers: { "Idempotency-Key": idempotencyKey } }); }