Skip to content

Commit 0661f9b

Browse files
committed
fix: backward compatibility issues
use concat and reduce instead of flat/map
1 parent 9f764b2 commit 0661f9b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

docker-compose.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
node10:
3+
image: node:10
4+
volumes:
5+
- .:/app
6+
working_dir: /app
7+
command: npm run test

src/lib/isDuration.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ const BaseDurationUnits = [
3434
'Ms',
3535
];
3636

37-
38-
const AllDurationUnits = new Set(BaseDurationUnits.map(unit => [unit,
39-
unit.toUpperCase(), unit.toLowerCase()]).flat());
37+
const AllDurationUnits = new Set(BaseDurationUnits.reduce((acc, unit) => acc.concat([
38+
unit, unit.toUpperCase(), unit.toLowerCase()]), []));
4039

4140
/**
4241
* Checks if the string is a valid duration.

0 commit comments

Comments
 (0)