lib/splitline.js
function SplitLine (options) {
  if (!(this instanceof SplitLine)) {
    return new SplitLine(options)
  }

  this.options = options || {}
  Transform.call(this, _omit(this.options, ['matcher', 'chomp']))

  this.offset = 0
  this.options.matcher = (typeof this.options.matcher === 'string'
    ? this.options.matcher.charCodeAt(0)
    : this.options.matcher || 0x0a)
  this.options.chomp = (this.options.chomp === true ? 0 : 1) // chomp newline
  this.buffer = Buffer.from('') // this.unshift cannot be used if options.highWaterMark is quite low!
  // That's why an own buffer is required here :/
  return this
}
function SplitLine (options) {
  if (!(this instanceof SplitLine)) {
    return new SplitLine(options)
  }

  this.options = options || {}
  Transform.call(this, _omit(this.options, ['matcher', 'chomp']))

  this.offset = 0
  this.options.matcher = (typeof this.options.matcher === 'string'
    ? this.options.matcher.charCodeAt(0)
    : this.options.matcher || 0x0a)
  this.options.chomp = (this.options.chomp === true ? 0 : 1) // chomp newline
  this.buffer = Buffer.from('') // this.unshift cannot be used if options.highWaterMark is quite low!
  // That's why an own buffer is required here :/
  return this
}
function SplitLine ( options ) { if ( ! ( this instanceof SplitLine ) ) { return new SplitLine ( options ) } this . options = options || { } Transform . call ( this , _omit ( this . options , [ 'matcher' , 'chomp' ] ) ) this . offset = 0 this . options . matcher = ( typeof this . options . matcher === 'string' ? this . options . matcher . charCodeAt ( 0 ) : this . options . matcher || 0x0a ) this . options . chomp = ( this . options . chomp === true ? 0 : 1 ) // chomp newline this . buffer = Buffer . from ( '' ) // this.unshift cannot be used if options.highWaterMark is quite low! // That's why an own buffer is required here :/ return this }
Split a stream by a single char

@constructor
@param {Object} [options] - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`
@param {Boolean} options.chomp - Do not emit the matching char. Default=false
@param {String} options.matcher - String use for splitting up the stream. Default=0x0a
@return {Transform} A transform stream
Split a stream by a single char