From 22259e32af6b907c3578187c4ba9a1a1eafd5f5a Mon Sep 17 00:00:00 2001 From: gogu Date: Fri, 2 Sep 2016 00:55:50 +0800 Subject: [PATCH] Fixed while sub is 0 length string. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b4f5e49..827b3c6 100755 --- a/index.js +++ b/index.js @@ -5,10 +5,10 @@ module.exports = function(content) { if (this.cacheable) { this.cacheable(); } var query = loaderUtils.parseQuery(this.query); - if (typeof query === "object" && query.regex && query.sub) { + if (typeof query === "object" && query.regex && typeof query.sub === "string") { var regex = new RegExp(query.regex, query.flags); content = content.replace(regex, query.sub); } return content; -}; \ No newline at end of file +};