src/index.js
function streamRecorder () {
  let lastKey, lastStream
  return (key, createStream) => {
    if (isFunction(key)) key = key.call()

    debug(`Recorder get key: ${key}`)

    if (key !== lastKey) {
      debug(`Recorder will return a new stream`)

      lastKey = key
      lastStream = createStream.call(null, key)
    }

    return lastStream
  }
}
function streamRecorder () {
  let lastKey, lastStream
  return (key, createStream) => {
    if (isFunction(key)) key = key.call()

    debug(`Recorder get key: ${key}`)

    if (key !== lastKey) {
      debug(`Recorder will return a new stream`)

      lastKey = key
      lastStream = createStream.call(null, key)
    }

    return lastStream
  }
}
function streamRecorder ( ) { let lastKey , lastStream return ( key , createStream ) => { if ( isFunction ( key ) ) key = key . call ( ) debug ( ` ${ key } ` ) if ( key !== lastKey ) { debug ( ` ` ) lastKey = key lastStream = createStream . call ( null , key ) } return lastStream } }
Record the stream by key
@return {function} A function return stream
Record the stream by key