From 52c7e43a5f76b72004435c6b31d2326dc2f4ac36 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Tue, 14 Aug 2012 07:01:20 -0700 Subject: [PATCH] throw inside the if --- mustache.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mustache.js b/mustache.js index 9e20b87..b17923a 100644 --- a/mustache.js +++ b/mustache.js @@ -376,14 +376,14 @@ var Mustache; } function escapeTags(tags) { - if (tags.length === 2) { - return [ - new RegExp(escapeRe(tags[0]) + "\\s*"), - new RegExp("\\s*" + escapeRe(tags[1])) - ]; + if (tags.length !== 2) { + throw new Error("Invalid tags: " + tags.join(" ")); } - throw new Error("Invalid tags: " + tags.join(" ")); + return [ + new RegExp(escapeRe(tags[0]) + "\\s*"), + new RegExp("\\s*" + escapeRe(tags[1])) + ]; } /**