Sha256: 4a12b3383b4be9897ceff48184ac7e9e3a0dccf0ea5ee219239c1c85e4bd8f46

Contents?: true

Size: 774 Bytes

Versions: 28

Compression:

Stored size: 774 Bytes

Contents

/*!
 * Express - view - Partial
 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
 * MIT Licensed
 */

/**
 * Memory cache.
 */

var cache = {};

/**
 * Resolve partial object name from the view path.
 *
 * Examples:
 *
 *   "user.ejs" becomes "user"
 *   "forum thread.ejs" becomes "forumThread"
 *   "forum/thread/post.ejs" becomes "post"
 *   "blog-post.ejs" becomes "blogPost"
 *
 * @return {String}
 * @api private
 */

exports.resolveObjectName = function(view){
  return cache[view] || (cache[view] = view
    .split('/')
    .slice(-1)[0]
    .split('.')[0]
    .replace(/^_/, '')
    .replace(/[^a-zA-Z0-9 ]+/g, ' ')
    .split(/ +/).map(function(word, i){
      return i
        ? word[0].toUpperCase() + word.substr(1)
        : word;
    }).join(''));
};

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
blackboard-3.1.9 lib/site_template/node_modules/express/lib/view/partial.js
vulcan-0.8.2 server/node_modules/express/lib/view/partial.js
vulcan-0.8.1 server/node_modules/express/lib/view/partial.js
vulcan-0.8.0 server/node_modules/express/lib/view/partial.js
vulcan-0.7.2 server/node_modules/express/lib/view/partial.js
vulcan-0.7.1 server/node_modules/express/lib/view/partial.js
vulcan-0.7.0 server/node_modules/express/lib/view/partial.js
vulcan-0.6.1 server/node_modules/express/lib/view/partial.js
vulcan-0.6.0 server/node_modules/express/lib/view/partial.js
vulcan-0.5.0 server/node_modules/express/lib/view/partial.js
vulcan-0.4.0 server/node_modules/express/lib/view/partial.js
vulcan-0.3.0 server/node_modules/express/lib/view/partial.js
vulcan-0.2.5 server/node_modules/express/lib/view/partial.js
vulcan-0.2.4 server/node_modules/express/lib/view/partial.js
vulcan-0.2.3 server/node_modules/express/lib/view/partial.js
vulcan-0.2.2 server/node_modules/express/lib/view/partial.js
vulcan-0.2.1 server/node_modules/express/lib/view/partial.js
vulcan-0.2.0 server/node_modules/express/lib/view/partial.js
vulcan-0.1.6 server/node_modules/express/lib/view/partial.js
vulcan-0.1.5 server/node_modules/express/lib/view/partial.js