lib/split.js
function Split (options) {
  if (!(this instanceof Split)) {
    return new Split(options)
  }
  if (options instanceof RegExp || typeof options === 'string') {
    options = { matcher: options }
  }
  this.options = Object.assign({
    matcher: /(\r?\n)/, // emits also newlines
    encoding: 'utf8'
  }, options)

  this.buffer = ''

  Transform.call(this, _omit(this.options, ['matcher']))

  return this
}
function Split (options) {
  if (!(this instanceof Split)) {
    return new Split(options)
  }
  if (options instanceof RegExp || typeof options === 'string') {
    options = { matcher: options }
  }
  this.options = Object.assign({
    matcher: /(\r?\n)/, // emits also newlines
    encoding: 'utf8'
  }, options)

  this.buffer = ''

  Transform.call(this, _omit(this.options, ['matcher']))

  return this
}
function Split ( options ) { if ( ! ( this instanceof Split ) ) { return new Split ( options ) } if ( options instanceof RegExp || typeof options === 'string' ) { options = { matcher : options } } this . options = Object . assign ( { matcher : / (\r?\n) / , // emits also newlines encoding : 'utf8' } , options ) this . buffer = '' Transform . call ( this , _omit ( this . options , [ 'matcher' ] ) ) return this }
Split a stream using a regexp or string based matcher

@constructor
@param {Object} [options] - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`
@param {RegExp|String} options.matcher - RegExp or String use for splitting up the stream. Default=/(\r?\n)/
@return {Transform} A transform stream
Split a stream using a regexp or string based matcher