diff options
| author | Adam Soltys <[email protected]> | 2012-11-07 17:46:49 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-11-07 17:52:50 -0800 |
| commit | 3e900e0bba211c2bbf2bb10c85a82dd9ce6943f0 (patch) | |
| tree | bb3ce237413df5fb0896a1696f7bd6f41ac248f3 /node_modules/express/lib/view.js | |
| parent | 5a4e3ff9bf1db2db4fc5ae8d3bd7dcefc8c58e25 (diff) | |
| download | coinos-server-3e900e0bba211c2bbf2bb10c85a82dd9ce6943f0.tar.gz coinos-server-3e900e0bba211c2bbf2bb10c85a82dd9ce6943f0.zip | |
Use coffeescript
Diffstat (limited to 'node_modules/express/lib/view.js')
| -rw-r--r-- | node_modules/express/lib/view.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/node_modules/express/lib/view.js b/node_modules/express/lib/view.js deleted file mode 100644 index 4007eccc..00000000 --- a/node_modules/express/lib/view.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Module dependencies. - */ - -var path = require('path') - , fs = require('fs') - , utils = require('./utils') - , dirname = path.dirname - , basename = path.basename - , extname = path.extname - , exists = fs.existsSync || path.existsSync - , join = path.join; - -/** - * Expose `View`. - */ - -module.exports = View; - -/** - * Initialize a new `View` with the given `name`. - * - * Options: - * - * - `defaultEngine` the default template engine name - * - `engines` template engine require() cache - * - `root` root path for view lookup - * - * @param {String} name - * @param {Object} options - * @api private - */ - -function View(name, options) { - options = options || {}; - this.name = name; - this.root = options.root; - var engines = options.engines; - this.defaultEngine = options.defaultEngine; - var ext = this.ext = extname(name); - if (!ext) name += (ext = this.ext = '.' + this.defaultEngine); - this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express); - this.path = this.lookup(name); -} - -/** - * Lookup view by the given `path` - * - * @param {String} path - * @return {String} - * @api private - */ - -View.prototype.lookup = function(path){ - var ext = this.ext; - - // <path>.<engine> - if (!utils.isAbsolute(path)) path = join(this.root, path); - if (exists(path)) return path; - - // <path>/index.<engine> - path = join(dirname(path), basename(path, ext), 'index' + ext); - if (exists(path)) return path; -}; - -/** - * Render with the given `options` and callback `fn(err, str)`. - * - * @param {Object} options - * @param {Function} fn - * @api private - */ - -View.prototype.render = function(options, fn){ - this.engine(this.path, options, fn); -}; |
