Skip to content

Commit 9518413

Browse files
committed
fix: drop replaceAll in order to support node 14
1 parent 8f789a6 commit 9518413

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/parse.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const fastDecode = require("fast-decode-uri-component");
44

5+
const plusRegex = /\+/g;
6+
57
/**
68
* @callback parse
79
* @param {string} input
@@ -45,7 +47,7 @@ function parse(input) {
4547
if (hasBothKeyValuePair || i - startingIndex > 1) {
4648
// Optimization: Replace '+' with space
4749
if (keyHasPlus) {
48-
key = key.replaceAll("+", " ");
50+
key = key.replace(plusRegex, " ");
4951
}
5052

5153
// Optimization: Do not decode if it's not necessary.
@@ -55,7 +57,7 @@ function parse(input) {
5557

5658
if (hasBothKeyValuePair) {
5759
if (valueHasPlus) {
58-
value = value.replaceAll("+", " ");
60+
value = value.replace(plusRegex, " ");
5961
}
6062

6163
if (shouldDecodeValue) {

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"description": "",
55
"main": "lib/index.js",
66
"type": "commonjs",
7-
"engines": {
8-
"node": ">= 15.0.0"
9-
},
107
"scripts": {
118
"format": "rome format . --write",
129
"format:ci": "rome format .",

0 commit comments

Comments
 (0)