From: Iskren Chernev Date: Tue, 17 Sep 2013 07:38:11 +0000 (-0700) Subject: Removing duplicate regexpEscape function X-Git-Tag: 2.3.0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=344901599d2dffed27ee9ff625788af9bc06bdc7;p=thirdparty%2Fmoment.git Removing duplicate regexpEscape function --- diff --git a/moment.js b/moment.js index 41c8297b2..f04afcdf3 100644 --- a/moment.js +++ b/moment.js @@ -415,10 +415,6 @@ }; } - function regexpEscape(text) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - } - function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; @@ -1062,8 +1058,7 @@ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function regexpEscape(s) { - var res = s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - return res; + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } // date from string and array of format strings