From b53aa1c4f5a113e980f5bf12b86b30cd67e3d8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 5 Jun 2018 01:21:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dempty=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=88=A0=E9=99=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tool.js | 14 ++++++++++---- package.json | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) 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",