|
|
@@ -11,7 +11,7 @@ function Func(args) { |
|
|
|
} |
|
|
|
Func.prototype = Function.prototype; |
|
|
|
|
|
|
|
module.exports = function(str, vals) { |
|
|
|
function Templish(str, vals) { |
|
|
|
str = str.replace(/\s+/g, " ").replace(/}}/g, "}}\n"); |
|
|
|
this.string = str; |
|
|
|
this.vals = vals; |
|
|
@@ -47,7 +47,7 @@ module.exports = function(str, vals) { |
|
|
|
}.bind(this)); |
|
|
|
} |
|
|
|
|
|
|
|
module.exports.prototype.exec = function(vals, cb) { |
|
|
|
Templish.prototype.exec = function(vals, cb) { |
|
|
|
var str = this.string; |
|
|
|
|
|
|
|
//Prepare generic arguments |
|
|
@@ -79,7 +79,7 @@ module.exports.prototype.exec = function(vals, cb) { |
|
|
|
//If this is the last callback to be executed, |
|
|
|
//call back with the resulting string |
|
|
|
if (cbsRemaining <= 0) |
|
|
|
cb(str); |
|
|
|
cb(null, str); |
|
|
|
cbsRemaining -= 1; |
|
|
|
} |
|
|
|
|
|
|
@@ -98,5 +98,7 @@ module.exports.prototype.exec = function(vals, cb) { |
|
|
|
//If there's no asynchronous functions to wait for, |
|
|
|
//just call back immediately |
|
|
|
if (cbsRemaining === 0) |
|
|
|
return cb(str); |
|
|
|
return cb(null, str); |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = Templish; |