Skip to content

Commit 1e1da4a

Browse files
authored
Polyfill replaceAll, ensure node10x compat (#28)
* testing with node v10.x to keep compatibility * polyfill replaceAll function
1 parent 9f1795a commit 1e1da4a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v1
9-
- name: Setup Environment (Using NodeJS 16.x)
9+
- name: Setup Environment (Using NodeJS 10.x)
1010
uses: actions/setup-node@v1
1111
with:
12-
node-version: 16.x
12+
node-version: 10.x
1313

1414
- name: Install dependencies
1515
run: npm install

lib/utils/queryparams.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = (req, url) => {
22
const [path, search = ''] = url.split('?')
3-
const searchParams = new URLSearchParams(search.replaceAll('[]=', '='))
3+
const searchParams = new URLSearchParams(search.replace(/\[\]=/g, '='))
4+
45
const query = {}
56
for (const [name, value] of searchParams.entries()) {
67
if (query[name]) {
@@ -11,6 +12,7 @@ module.exports = (req, url) => {
1112
query[name] = value
1213
}
1314
}
15+
1416
req.path = path
1517
req.query = query
1618
}

0 commit comments

Comments
 (0)