diff --git a/lib/tool.js b/lib/tool.js index 9ad03c3..903a6b6 100644 --- a/lib/tool.js +++ b/lib/tool.js @@ -149,7 +149,7 @@ class Tool { m = m.replace(begin, '').replace(end, '') m = m.trim() - if (empty(m) || !/\sin\s/.test(m)) { + if (!m || !/\sin\s/.test(m)) { return new Error('Wrong each loop') } @@ -175,7 +175,9 @@ class Tool { m = m.replace(begin, '').replace(end, '') m = m.trim() - if (empty(m)) return `\`; tpl += \`` + if (!m) { + return `\`; tpl += \`` + } return `\`; if (${m}){ tpl += \`` } @@ -188,7 +190,9 @@ class Tool { m = m.replace(begin, '').replace(end, '') m = m.trim() - if (empty(m)) return `\`;} else { tpl += \`` + if (!m) { + return `\`;} else { tpl += \`` + } return `\`; } else if (${m}){ tpl += \`` } @@ -201,7 +205,9 @@ class Tool { m = m.replace(begin, '').replace(end, '') m = m.trim() - if (!empty(m) || /=/.test(m)) m = 'let ' + m + if (m && /=/.test(m)) { + m = 'let ' + m + } this.vars += ` ${m};` diff --git a/package.json b/package.json index d767ffd..69a7cc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartyx", - "version": "1.0.1", + "version": "1.0.2", "description": "nodeJS模板引擎,理念源自于PHP的smarty模板引擎", "keywords": [ "fivejs",