summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiran Shao <shaoairan@gmail.com>2017-02-11 14:52:52 +0800
committerAiran Shao <shaoairan@gmail.com>2017-02-11 14:52:52 +0800
commita91f62267610ce95fee24e4d25493caf7fb9d2b9 (patch)
tree68af2e5f85a7759ab1c006afb4b421c185b5ddee
parent97d39b6c2bf533d33538205a399638b63f6baa66 (diff)
downloadyamljs-a91f62267610ce95fee24e4d25493caf7fb9d2b9.tar.gz
replaceAll always replace str with ''
Should replace matching string with parameter "replacement", not ''.
-rw-r--r--src/Pattern.coffee2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Pattern.coffee b/src/Pattern.coffee
index e65fa79..82f96e7 100644
--- a/src/Pattern.coffee
+++ b/src/Pattern.coffee
@@ -134,7 +134,7 @@ class Pattern
count = 0
while @regex.test(str) and (limit is 0 or count < limit)
@regex.lastIndex = 0
- str = str.replace @regex, ''
+ str = str.replace @regex, replacement
count++
return [str, count]