From 1b663e9bdf2042f1cf6a78ff72d81dccee4b052f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 14 May 2014 07:15:18 -0400 Subject: [PATCH] refactor(util) escapeRegExp --- lib/util.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/util.js b/lib/util.js index 75390bd1..bab8a0ff 100644 --- a/lib/util.js +++ b/lib/util.js @@ -529,14 +529,13 @@ return conv; }; - this.escapeRegExp = function(pStr) { - var ret = pStr, - isStr = Util.isString(pStr); + this.escapeRegExp = function(str) { + var isStr = Util.isString(str); if (isStr) - ret = pStr.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + str = str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); - return ret; + return str; }; /**