Skip to content
Myr

Caching view path derived partial object names

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 08b3677 · Browse files · 1 file+11 added−1 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+11 added−1 removed

  • other:+11 added−1 removed

1 file+11 added−1 removed

modified:lib/express/view.js+11 added-1 removed
32 unmodified lines
3334var viewCache = {};3536/**37 * Cache view path derived names.38 *39 * @type Object40 */4142var viewNameCache = {};4344/**45 * Synchronously cache view at the given `path`.46 *47 * @param {String} path48 * @return {String}
94 unmodified lines
143 options.partial = true;144 options.layout = false;145146 // Deduce name from view path139 var name = options.as || view.split('/').slice(-1)[0].split('.')[0];147 var name = options.as148 || viewNameCache[view]149 || (viewNameCache[view] = view.split('/').slice(-1)[0].split('.')[0]);150151 // Collection support152 var collection = options.collection;153 if (collection) {
176 unmodified lines