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

Commit

Permalink
parser: move record delimiter declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Nov 13, 2018
1 parent 1ae4de5 commit a72e0b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Expand Up @@ -242,7 +242,6 @@ class Parser extends Transform {
if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){
this.state.wasRowDelimiter = true
}
let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)
// Previous char was a valid escape char
// treat the current char as a regular char
if(this.state.escaping === true){
Expand Down Expand Up @@ -303,6 +302,7 @@ class Parser extends Transform {
}
}
if(this.state.quoting === false){
let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)
if(recordDelimiterLength !== 0){
// Do not emit comments which take a full line
const skipCommentLine = this.state.commenting && (this.state.record.length === 0 && this.state.field.length === 0)
Expand All @@ -315,7 +315,7 @@ class Parser extends Transform {
this.info.empty_lines++
continue
}
if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter ? 1: 0 ) >= from_line){
if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){
this.state.enabled = true
this.__resetField()
this.__resetRow()
Expand Down

0 comments on commit a72e0b1

Please sign in to comment.