src/index.js
function transformDecode(chunk, encoding, cb) {
  this.append(chunk);

  try {
    while (this.length > 0) {
      const transaction = new Transaction(this);
      const data = decode(transaction, this[kschema]);

      transaction.commit();
      this.push(data);
    }

    cb();
  } catch (error) {
    if (error instanceof NotEnoughDataError) {
      cb();
    } else {
      cb(error);
    }
  }
}
function transformDecode(chunk, encoding, cb) {
  this.append(chunk);

  try {
    while (this.length > 0) {
      const transaction = new Transaction(this);
      const data = decode(transaction, this[kschema]);

      transaction.commit();
      this.push(data);
    }

    cb();
  } catch (error) {
    if (error instanceof NotEnoughDataError) {
      cb();
    } else {
      cb(error);
    }
  }
}
function transformDecode ( chunk , encoding , cb ) { this . append ( chunk ) ; try { while ( this . length > 0 ) { const transaction = new Transaction ( this ) ; const data = decode ( transaction , this [ kschema ] ) ; transaction . commit ( ) ; this . push ( data ) ; } cb ( ) ; } catch ( error ) { if ( error instanceof NotEnoughDataError ) { cb ( ) ; } else { cb ( error ) ; } } }
The `transform` function for transform stream.
@param {*} chunk Any valid js data type.
@param {string} encoding
@param {Function} cb
The transform function for transform stream .