Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit db8d197

Browse filesBrowse files
BridgeARaddaleax
authored andcommitted
lib,test: remove yoda statements
PR-URL: #18746 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a938e52 commit db8d197
Copy full SHA for db8d197

File tree

Expand file treeCollapse file tree

11 files changed

+27
-29
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

11 files changed

+27
-29
lines changed
Open diff view settings
Collapse file

‎lib/_stream_readable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_readable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ function resume_(stream, state) {
839839

840840
Readable.prototype.pause = function() {
841841
debug('call pause flowing=%j', this._readableState.flowing);
842-
if (false !== this._readableState.flowing) {
842+
if (this._readableState.flowing !== false) {
843843
debug('pause');
844844
this._readableState.flowing = false;
845845
this.emit('pause');
Collapse file

‎lib/internal/readline.js‎

Copy file name to clipboardExpand all lines: lib/internal/readline.js
+15-15Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,33 @@ if (process.binding('config').hasIntl) {
8787
if (
8888
code >= 0x1100 && (
8989
code <= 0x115f || // Hangul Jamo
90-
0x2329 === code || // LEFT-POINTING ANGLE BRACKET
91-
0x232a === code || // RIGHT-POINTING ANGLE BRACKET
90+
code === 0x2329 || // LEFT-POINTING ANGLE BRACKET
91+
code === 0x232a || // RIGHT-POINTING ANGLE BRACKET
9292
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
93-
(0x2e80 <= code && code <= 0x3247 && code !== 0x303f) ||
93+
code >= 0x2e80 && code <= 0x3247 && code !== 0x303f ||
9494
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
95-
0x3250 <= code && code <= 0x4dbf ||
95+
code >= 0x3250 && code <= 0x4dbf ||
9696
// CJK Unified Ideographs .. Yi Radicals
97-
0x4e00 <= code && code <= 0xa4c6 ||
97+
code >= 0x4e00 && code <= 0xa4c6 ||
9898
// Hangul Jamo Extended-A
99-
0xa960 <= code && code <= 0xa97c ||
99+
code >= 0xa960 && code <= 0xa97c ||
100100
// Hangul Syllables
101-
0xac00 <= code && code <= 0xd7a3 ||
101+
code >= 0xac00 && code <= 0xd7a3 ||
102102
// CJK Compatibility Ideographs
103-
0xf900 <= code && code <= 0xfaff ||
103+
code >= 0xf900 && code <= 0xfaff ||
104104
// Vertical Forms
105-
0xfe10 <= code && code <= 0xfe19 ||
105+
code >= 0xfe10 && code <= 0xfe19 ||
106106
// CJK Compatibility Forms .. Small Form Variants
107-
0xfe30 <= code && code <= 0xfe6b ||
107+
code >= 0xfe30 && code <= 0xfe6b ||
108108
// Halfwidth and Fullwidth Forms
109-
0xff01 <= code && code <= 0xff60 ||
110-
0xffe0 <= code && code <= 0xffe6 ||
109+
code >= 0xff01 && code <= 0xff60 ||
110+
code >= 0xffe0 && code <= 0xffe6 ||
111111
// Kana Supplement
112-
0x1b000 <= code && code <= 0x1b001 ||
112+
code >= 0x1b000 && code <= 0x1b001 ||
113113
// Enclosed Ideographic Supplement
114-
0x1f200 <= code && code <= 0x1f251 ||
114+
code >= 0x1f200 && code <= 0x1f251 ||
115115
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
116-
0x20000 <= code && code <= 0x3fffd
116+
code >= 0x20000 && code <= 0x3fffd
117117
)
118118
) {
119119
return true;
Collapse file

‎lib/internal/streams/legacy.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/legacy.js
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ Stream.prototype.pipe = function(dest, options) {
1212
var source = this;
1313

1414
function ondata(chunk) {
15-
if (dest.writable) {
16-
if (false === dest.write(chunk) && source.pause) {
17-
source.pause();
18-
}
15+
if (dest.writable && dest.write(chunk) === false && source.pause) {
16+
source.pause();
1917
}
2018
}
2119

Collapse file

‎test/common/inspector-helper.js‎

Copy file name to clipboardExpand all lines: test/common/inspector-helper.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class InspectorSession {
241241
}
242242

243243
_isBreakOnLineNotification(message, line, expectedScriptPath) {
244-
if ('Debugger.paused' === message.method) {
244+
if (message.method === 'Debugger.paused') {
245245
const callFrame = message.params.callFrames[0];
246246
const location = callFrame.location;
247247
const scriptPath = this._scriptsIdsByUrl.get(location.scriptId);
@@ -264,7 +264,7 @@ class InspectorSession {
264264
_matchesConsoleOutputNotification(notification, type, values) {
265265
if (!Array.isArray(values))
266266
values = [ values ];
267-
if ('Runtime.consoleAPICalled' === notification.method) {
267+
if (notification.method === 'Runtime.consoleAPICalled') {
268268
const params = notification.params;
269269
if (params.type === type) {
270270
let i = 0;
Collapse file

‎test/parallel/test-dns-multi-channel.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-dns-multi-channel.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ for (const { socket, reply } of servers) {
3131
}));
3232

3333
socket.bind(0, common.mustCall(() => {
34-
if (0 === --waiting) ready();
34+
if (--waiting === 0) ready();
3535
}));
3636
}
3737

Collapse file

‎test/parallel/test-fs-watch-recursive.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-watch-recursive.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const watcher = fs.watch(testDir, { recursive: true });
2424

2525
let watcherClosed = false;
2626
watcher.on('change', function(event, filename) {
27-
assert.ok('change' === event || 'rename' === event);
27+
assert.ok(event === 'change' || event === 'rename');
2828

2929
// Ignore stale events generated by mkdir and other tests
3030
if (filename !== relativePathOne)
Collapse file

‎test/parallel/test-net-pingpong.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-pingpong.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function pingPongTest(port, host) {
5353
// Since we never queue data (we're always waiting for the PING
5454
// before sending a pong) the writeQueueSize should always be less
5555
// than one message.
56-
assert.ok(0 <= socket.bufferSize && socket.bufferSize <= 4);
56+
assert.ok(socket.bufferSize >= 0 && socket.bufferSize <= 4);
5757

5858
assert.strictEqual(socket.writable, true);
5959
assert.strictEqual(socket.readable, true);
Collapse file

‎test/parallel/test-net-server-max-connections.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-server-max-connections.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function makeConnection(index) {
8888

8989
c.on('data', function(b) {
9090
gotData = true;
91-
assert.ok(0 < b.length);
91+
assert.ok(b.length > 0);
9292
});
9393

9494
c.on('error', function(e) {
Collapse file

‎test/parallel/test-tls-pause.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-pause.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ server.listen(0, common.mustCall(() => {
6060
console.error('sending');
6161
const ret = client.write(Buffer.allocUnsafe(bufSize));
6262
console.error(`write => ${ret}`);
63-
if (false !== ret) {
63+
if (ret !== false) {
6464
console.error('write again');
6565
sent += bufSize;
6666
assert.ok(sent < 100 * 1024 * 1024); // max 100MB
Collapse file

‎test/pummel/test-net-throttle.js‎

Copy file name to clipboardExpand all lines: test/pummel/test-net-throttle.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const server = net.createServer(function(connection) {
3939
connection.write(body.slice(part_N, 2 * part_N));
4040
assert.strictEqual(false, connection.write(body.slice(2 * part_N, N)));
4141
console.log(`bufferSize: ${connection.bufferSize}`, 'expecting', N);
42-
assert.ok(0 <= connection.bufferSize &&
42+
assert.ok(connection.bufferSize >= 0 &&
4343
connection.writableLength <= N);
4444
connection.end();
4545
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.