mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fix(util) replaceStr: escape before create
This commit is contained in:
parent
757a85bee9
commit
0093c8e650
1 changed files with 4 additions and 3 deletions
|
|
@ -494,14 +494,15 @@
|
|||
* @param notEscape
|
||||
*/
|
||||
this.replaceStr = function(str, from, to, notEscape) {
|
||||
var isStr = Util.isString(str),
|
||||
regExp = new RegExp(from, 'g');
|
||||
var regExp,
|
||||
isStr = Util.isString(str);
|
||||
|
||||
if (isStr && from) {
|
||||
if (!notEscape)
|
||||
from = Util.escapeRegExp(from);
|
||||
|
||||
str = str.replace(regExp, to);
|
||||
regExp = new RegExp(from, 'g');
|
||||
str = str.replace(regExp, to);
|
||||
}
|
||||
|
||||
return str;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue