File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 227227 delimiter : "" ,
228228 header : true ,
229229 dynamicTyping : true ,
230- preview : 0
230+ preview : 0 ,
231+ commentChar : false
231232 } ;
232233 var _regex = {
233234 floats : / ^ \s * - ? ( \d * \. ? \d + | \d + \. ? \d * ) ( e [ - + ] ? \d + ) ? \s * $ / i,
240241 header : config . header ,
241242 dynamicTyping : config . dynamicTyping ,
242243 preview : config . preview ,
243- step : config . step
244+ step : config . step ,
245+ commentChar : config . commentChar
244246 } ;
245247
246248 this . parse = function ( input )
262264 break ;
263265
264266 _state . ch = _input [ _state . i ] ;
267+
268+ if ( _config . commentChar ) {
269+ // Check if line begins with a commentChar
270+ if ( _state . line == "" && _state . ch == _config . commentChar ) {
271+ newRow ( ) ;
272+
273+ // skip to next row
274+ while ( true ) {
275+ ++ _state . i
276+ if ( _input [ _state . i ] == "\r" || _input [ _state . i ] == "\n" )
277+ break ;
278+ }
279+ }
280+
281+ _state . ch = _input [ _state . i ] ;
282+
283+ }
284+
265285 _state . line += _state . ch ;
266286
267287 if ( _state . ch == '"' )
319339 if ( typeof config . step !== 'function' )
320340 config . step = _defaultConfig . step ;
321341
342+ if ( config . commentChar === true )
343+ config . commentChar = '#' ;
344+
345+ if ( typeof config . commentChar !== 'string' && config . commentChar !== false )
346+ config . commentChar = false ;
347+
322348 return config ;
323349 }
324350
You can’t perform that action at this time.
0 commit comments