Skip to content

Commit f55e570

Browse files
committed
Refactor version check.
1 parent c702f98 commit f55e570

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/agentCompatibility.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import {versions} from 'node:process';
99
const AGENT_CACHE = new WeakMap();
1010

1111
// can only convert agent to dispatcher option on node 18.2+
12-
const [major, minor] = versions.node.split('.');
13-
const canConvert =
14-
(parseInt(major, 10) > 18) ||
15-
(parseInt(major, 10) === 18 && parseInt(minor, 10) >= 2);
12+
const [major, minor] = versions.node.split('.').map(v => parseInt(v, 10));
13+
const canConvert = (major > 18) || (major === 18 && minor >= 2);
1614

1715
// converts `agent`/`httpsAgent` option to a dispatcher option
1816
export function convertAgent(options) {

0 commit comments

Comments
 (0)