Skip to content

Commit 7178588

Browse files
authoredOct 9, 2024
lib: prefer logical assignment
PR-URL: #55044 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 09d10b5 commit 7178588

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+177
-301
lines changed
 

Diff for: ‎benchmark/_http-benchmarkers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TestDoubleBenchmarker {
110110
}
111111

112112
create(options) {
113-
process.env.duration = process.env.duration || options.duration || 5;
113+
process.env.duration ||= options.duration || 5;
114114

115115
const scheme = options.scheme || 'http';
116116
const env = {

Diff for: ‎benchmark/common.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class Benchmark {
113113
}
114114
const [, key, value] = match;
115115
if (configs[key] !== undefined) {
116-
if (!cliOptions[key])
117-
cliOptions[key] = [];
116+
cliOptions[key] ||= [];
118117
cliOptions[key].push(
119118
// Infer the type from the config object and parse accordingly
120119
typeof configs[key][0] === 'number' ? +value : value,
@@ -177,10 +176,9 @@ class Benchmark {
177176

178177
http(options, cb) {
179178
const http_options = { ...options };
180-
http_options.benchmarker = http_options.benchmarker ||
181-
this.config.benchmarker ||
182-
this.extra_options.benchmarker ||
183-
http_benchmarkers.default_http_benchmarker;
179+
http_options.benchmarker ||= this.config.benchmarker ||
180+
this.extra_options.benchmarker ||
181+
http_benchmarkers.default_http_benchmarker;
184182
http_benchmarkers.run(
185183
http_options, (error, code, used_benchmarker, result, elapsed) => {
186184
if (cb) {

0 commit comments

Comments
 (0)