]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Removing duplicate regexpEscape function
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 17 Sep 2013 07:38:11 +0000 (00:38 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Tue, 17 Sep 2013 07:38:11 +0000 (00:38 -0700)
moment.js

index 41c8297b225fc4eb35843907695fba609934ca09..f04afcdf3f2ea32c454d9dcd2130afa444e5c3f1 100644 (file)
--- a/moment.js
+++ b/moment.js
         };
     }
 
-    function regexpEscape(text) {
-        return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
-    }
-
     function toInt(argumentForCoercion) {
         var coercedNumber = +argumentForCoercion,
             value = 0;
 
     // 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