Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit c980b5f

Browse files
committed
src: cache length in loops
1 parent 8a8c87a commit c980b5f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* promise: new API module
1111
* errors: finish normalisation of all errors
1212

13+
## Trunk
14+
15+
* src: cache length in loops
16+
1317
## Version 4.8.8
1418

1519
* api: fix regression in browser environments

lib/es5/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
858858
if (columns !== false) {
859859
var obj = {}; // Transform record array to an object
860860

861-
for (var i in record) {
861+
for (var i = 0, l = record.length; i < l; i++) {
862862
if (columns[i] === undefined || columns[i].disabled) continue;
863863
obj[columns[i].name] = record[i];
864864
}
@@ -1326,7 +1326,7 @@ var isRecordEmpty = function isRecordEmpty(record) {
13261326
var normalizeColumnsArray = function normalizeColumnsArray(columns) {
13271327
var normalizedColumns = [];
13281328

1329-
for (var i = 0; i < columns.length; i++) {
1329+
for (var i = 0, l = columns.length; i < l; i++) {
13301330
var column = columns[i];
13311331

13321332
if (column === undefined || column === null || column === false) {

lib/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ class Parser extends Transform {
726726
if(columns !== false){
727727
const obj = {}
728728
// Transform record array to an object
729-
for(let i in record){
729+
for(let i = 0, l = record.length; i < l; i++){
730730
if(columns[i] === undefined || columns[i].disabled) continue
731731
obj[columns[i].name] = record[i]
732732
}
@@ -1090,8 +1090,7 @@ const isRecordEmpty = function(record){
10901090

10911091
const normalizeColumnsArray = function(columns){
10921092
const normalizedColumns = [];
1093-
1094-
for(let i=0; i< columns.length; i++){
1093+
for(let i = 0, l = columns.length; i < l; i++){
10951094
const column = columns[i]
10961095
if(column === undefined || column === null || column === false){
10971096
normalizedColumns[i] = { disabled: true }

0 commit comments

Comments
 (0)