cover all

This commit is contained in:
harttle
2017-08-15 23:52:05 +08:00
parent 6d59f34fc8
commit 030037eedc
14 changed files with 286 additions and 246 deletions
+1
View File
@@ -82,6 +82,7 @@ function parseLiteral (str) {
if (res) {
return str.slice(1, -1)
}
throw new TypeError(`cannot parse '${str}' as literal`)
}
module.exports = {
+1
View File
@@ -40,6 +40,7 @@ function evalValue (str, scope) {
if (lexical.isVariable(str)) {
return scope.get(str)
}
throw new TypeError(`cannot eval '${str}' as value`)
}
function isTruthy (val) {
+1 -5
View File
@@ -25,11 +25,7 @@ module.exports = function () {
if (typeof impl.render !== 'function') {
return Promise.resolve('')
}
return Promise.resolve()
.then(() => typeof impl.render === 'function'
? impl.render(scope, obj)
: ''
)
return Promise.resolve().then(() => impl.render(scope, obj))
},
parse: function (token, tokens) {
this.type = 'tag'
+1
View File
@@ -163,6 +163,7 @@ var formatCodes = {
},
z: function (d) {
var tz = d.getTimezoneOffset() / 60 * 100
console.log('tz', tz)
return (tz > 0 ? '-' : '+') + _number.pad(Math.abs(tz), 4)
},
'%': function () {