@@ -2,9 +2,8 @@ import { Converter } from "./Converter";
22import CSVError from "./CSVError" ;
33import { CellParser , ColumnParam } from "./Parameters" ;
44import set from "lodash/set" ;
5- import { ParseRuntime } from "./ParseRuntime" ;
65
7- var numReg = / ^ [ - + ] ? [ 0 - 9 ] * \. ? [ 0 - 9 ] + ( [ e E ] [ - + ] ? [ 0 - 9 ] + ) ? $ / ;
6+ const numReg = / ^ [ - + ] ? [ 0 - 9 ] * \. ? [ 0 - 9 ] + ( [ e E ] [ - + ] ? [ 0 - 9 ] + ) ? $ / ;
87
98export default function ( csvRows : string [ ] [ ] , conv : Converter ) : JSONResult [ ] {
109 const res : JSONResult [ ] = [ ] ;
@@ -58,10 +57,6 @@ function convertRowToJson(row: string[], headRow: string[], conv: Converter): {
5857 setPath ( resultRow , head , convRes , conv , i ) ;
5958 }
6059 } else {
61- // var flag = getFlag(head, i, param);
62- // if (flag === 'omit') {
63- // continue;
64- // }
6560 if ( conv . parseParam . checkType ) {
6661 const convertFunc = checkType ( item , head , i , conv ) ;
6762 item = convertFunc ( item ) ;
@@ -193,12 +188,8 @@ function dynamicType(item) {
193188}
194189
195190function booleanType ( item ) {
196- var trimed = item . trim ( ) ;
197- if ( trimed . length === 5 && trimed . toLowerCase ( ) === "false" ) {
198- return false ;
199- } else {
200- return true ;
201- }
191+ const trimmed = item . trim ( ) ;
192+ return ! ( trimmed . length === 5 && trimmed . toLowerCase ( ) === "false" ) ;
202193}
203194
204195function jsonType ( item ) {
0 commit comments