Skip to content
Myr

`app.dynamicHelpers` -> `app.dynamicLocals`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 232b6ab · Browse files · 3 files+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−11 removed

  • tests:+1 added−1 removed
  • other:+10 added−10 removed

3 files+11 added−11 removed

modified:lib/http.js+3 added-3 removed
61 unmodified lines
62 this.settings = {};63 this.redirects = {};64 this.isCallbacks = {};65 this._locals = {};66 this.dynamicViewHelpers = {};66 this._dynamicLocals = {};6768 this.set('home', '/');69 this.set('env', process.env.NODE_ENV || 'development');70
205 unmodified lines
276 * @return {Server} for chaining277 * @api public278 */279280app.dynamicHelpers = function(obj){281 utils.merge(this.dynamicViewHelpers, obj);280app.dynamicLocals = function(obj){281 utils.merge(this._dynamicLocals, obj);282 return this;283};284285/**
216 unmodified lines
modified:lib/view.js+7 added-7 removed
334 unmodified lines
335 var options = {}336 , self = this337 , app = this.app338 , helpers = app._locals339 , dynamicHelpers = app.dynamicViewHelpers339 , dynamic = app._dynamicLocals340 , viewOptions = app.set('view options')341 , root = app.set('views') || process.cwd() + '/views';342343 // cache id
42 unmodified lines
386 // charset option387 if (options.charset) this.charset = options.charset;388389 // Dynamic helper support390 if (false !== options.dynamicHelpers) {390 if (false !== options.dynamic) {391 // cache392 if (!this.__dynamicHelpers) {393 this.__dynamicHelpers = {};394 for (var key in dynamicHelpers) {395 this.__dynamicHelpers[key] = dynamicHelpers[key].call(392 if (!this.__dynamic) {393 this.__dynamic = {};394 for (var key in dynamic) {395 this.__dynamic[key] = dynamic[key].call(396 this.app397 , this.req398 , this);399 }400 }401402 // apply403 merge(options, this.__dynamicHelpers);403 merge(options, this.__dynamic);404 }405406 // Merge view helpers407 union(options, helpers);
52 unmodified lines
modified:test/view.test.js+1 added-1 removed
326 unmodified lines
327 return 'Hello ' + sess.name + ' ' + lastName; 328 }329 });330 331 var ret = app.dynamicHelpers({331 var ret = app.dynamicLocals({332 session: function(req, res){333 ++calls;334 req.should.be.a('object');335 res.should.be.a('object');
817 unmodified lines