Skip to content
Myr

Implemented dynamic helper cache. Closes #439

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 b083aed · Browse files · 1 file+16 added−9 removed
This commit

State

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

Diff stats

1 file+16 added−9 removed

  • other:+16 added−9 removed

1 file+16 added−9 removed

modified:lib/express/view.js+16 added-9 removed
238 unmodified lines
239 options.locals.__filename = options.filename = path;240241 // Dynamic helper support242 if (options.dynamicHelpers !== false) {243 // cache244 if (!this.__dynamicHelpers) {245 this.__dynamicHelpers = {};243 var keys = Object.keys(dynamicHelpers);244 for (var i = 0, len = keys.length; i < len; ++i) {245 var key = keys[i],246 val = dynamicHelpers[key];247 if (typeof val === 'function') {248 helpers[key] = val.call(249 this.app, 250 this.req, 251 this);246 var keys = Object.keys(dynamicHelpers);247 for (var i = 0, len = keys.length; i < len; ++i) {248 var key = keys[i],249 val = dynamicHelpers[key];250 if (typeof val === 'function') {251 this.__dynamicHelpers[key] = val.call(252 this.app, 253 this.req, 254 this);255 }256 }257 }258259 // apply260 utils.merge(helpers, this.__dynamicHelpers);261 }262263 // Always expose partial() as a local264 options.locals.partial = function(view, options){
45 unmodified lines