bare-script 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/library.js +4 -1
  2. package/package.json +1 -1
package/lib/library.js CHANGED
@@ -888,7 +888,10 @@ function regexReplace([regex, string, substr]) {
888
888
  return null;
889
889
  }
890
890
 
891
- return string.replace(regex, substr);
891
+ // Re-compile the regex with the "g" flag, if necessary
892
+ const regexGlobal = (regex.flags.indexOf('g') !== -1 ? regex : new RegExp(regex.source, `${regex.flags}g`));
893
+
894
+ return string.replaceAll(regexGlobal, substr);
892
895
  }
893
896
 
894
897
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bare-script",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "description": "BareScript; a lightweight scripting and expression language",
6
6
  "keywords": [
7
7
  "expression",