Skip to content

Commit b5806f4

Browse files
committed
perf(result): avoid unnecessary operation
1 parent 65bc3d4 commit b5806f4

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

packages/pg/lib/result.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,9 @@ class Result {
6464
const row = { ...this._prebuiltEmptyResultObject }
6565
for (let i = 0, len = rowData.length; i < len; i++) {
6666
const rawValue = rowData[i]
67-
const field = this.fields[i].name
6867
if (rawValue !== null) {
69-
const v = this.fields[i].format === 'binary' ? Buffer.from(rawValue) : rawValue
70-
row[field] = this._parsers[i](v)
71-
} else {
72-
row[field] = null
68+
const field = this.fields[i]
69+
row[field.name] = this._parsers[i](field.format === 'binary' ? Buffer.from(rawValue) : rawValue)
7370
}
7471
}
7572
return row

0 commit comments

Comments
 (0)