Skip to content

Commit e1d58f6

Browse files
committed
slightly faster result logic
1 parent 43e7933 commit e1d58f6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/pg/lib/result.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,11 @@ class Result {
6969
}
7070

7171
parseRow(rowData) {
72-
var row = { ...this._prebuiltEmptyResultObject }
73-
for (var i = 0, len = rowData.length; i < len; i++) {
72+
let row = { ...this._prebuiltEmptyResultObject }
73+
for (let i = 0, len = rowData.length; i < len; i++) {
7474
var rawValue = rowData[i]
75-
var field = this.fields[i].name
7675
if (rawValue !== null) {
77-
row[field] = this._parsers[i](rawValue)
78-
} else {
79-
row[field] = null
76+
row[this.fields[i].name] = this._parsers[i](rawValue)
8077
}
8178
}
8279
return row
@@ -108,7 +105,7 @@ class Result {
108105
this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || 'text')
109106
}
110107
}
111-
this._prebuiltEmptyResultObject = { ...row }
108+
this._prebuiltEmptyResultObject = row
112109
}
113110
}
114111

0 commit comments

Comments
 (0)