Code coverage report for lib/template.js

Statements: 100% (17 / 17)      Branches: 75% (3 / 4)      Functions: 100% (3 / 3)      Lines: 100% (16 / 16)      Ignored: none     

All files » lib/ » template.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  1 1   1   1 70   35 35     35   35 35       1 1   1         1 1   1    
 
const path = require('path')
const hogan = require('hogan.js')
 
module.exports = Template
 
function Template(options) {
  if (!(this instanceof Template)) return new Template(options)
 
  Eif (typeof options === 'string') {
    options = { basedir: options }
  }
 
  var template = this
 
  template.basedir = path.resolve(options.basedir)
  template.collection = {}
}
 
// this should be async so partials can be crawled and compiled
Template.prototype.compile = function(key, content) {
  var template = this
 
  template.collection[key] = hogan.compile(content)
 
  // scan for partials
}
 
Template.prototype.render = function(key, context) {
  var template = this
 
  return template.collection[key].render(context)
}