Skip to content
Myr

Added objectName()

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 6fcd74c · Browse files · 1 file+20 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+20 added−1 removed

  • other:+20 added−1 removed

1 file+20 added−1 removed

modified:lib/express/view.js+20 added-1 removed
64 unmodified lines
65 return app.set('views') || process.cwd() + '/views';66}6768/**69 * Return object name deduced from the given `view` path.70 *71 * Examples:72 *73 * "movie/director" -> director74 * "movie.director" -> director75 * "forum/thread/post" -> post76 * "forum/thread.post" -> post77 *78 * @param {String} view79 * @return {String}80 * @api private81 */8283function objectName(view) {84 return view.split('/').slice(-1)[0].split('.')[0];85}8687/**88 * Register the given template engine `exports`89 * as `ext`. For example we may wish to map ".html"90 * files to jade:91 *
75 unmodified lines
167168 // Deduce name from view path169 var name = options.as170 || viewNameCache[view]152 || (viewNameCache[view] = view.split('/').slice(-1)[0].split('.')[0]);171 || (viewNameCache[view] = objectName(view));172173 // Collection support174 var collection = options.collection;175 if (collection) {
176 unmodified lines