Skip to content

refactor: use for...of for better readability #3472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/pg-cursor/index.js
Original file line number Diff line number Diff line change
@@ -174,8 +174,7 @@ class Cursor extends EventEmitter {
this._cb(msg)
}
// dispatch error to all waiting callbacks
for (let i = 0; i < this._queue.length; i++) {
const queuedCallback = this._queue[i][1]
for (const [_, queuedCallback] of this._queue) {
queuedCallback.call(this, msg)
}
this._queue.length = 0
3 changes: 1 addition & 2 deletions packages/pg/lib/utils.js
Original file line number Diff line number Diff line change
@@ -173,8 +173,7 @@ const escapeLiteral = function (str) {
let hasBackslash = false
let escaped = "'"

for (let i = 0; i < str.length; i++) {
const c = str[i]
for (const c of str) {
if (c === "'") {
escaped += c + c
} else if (c === '\\') {
4 changes: 2 additions & 2 deletions packages/pg/test/cli.js
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
const ConnectionParameters = require('../lib/connection-parameters')
const config = new ConnectionParameters(process.argv[2])

for (let i = 0; i < process.argv.length; i++) {
switch (process.argv[i].toLowerCase()) {
for (const arg of process.argv) {
switch (arg.toLowerCase()) {
case 'native':
config.native = true
break