stream-processing.js
function useStreamEventRecordAsMessage(record, batch, extractMessageFromRecord, context) {
  if (!record || typeof record !== 'object') {
    context.warn(`Adding invalid record (${record}) as an unusable record`);
    return Promise.resolve([{unusableRec: batch.addUnusableRecord(record, undefined, `invalid record (${record})`, context)}]);
  }

  const messageOutcome = Try.try(() => copy(record, deep));

  // Add the "message" or unusable record to the batch
  return messageOutcome.map(
    message => {
      return [batch.addMessage(message, record, undefined, context)];
    },
    err => {
      return [{unusableRec: batch.addUnusableRecord(record, undefined, err.message, context)}];
    }
  ).toPromise();
}
function useStreamEventRecordAsMessage(record, batch, extractMessageFromRecord, context) {
  if (!record || typeof record !== 'object') {
    context.warn(`Adding invalid record (${record}) as an unusable record`);
    return Promise.resolve([{unusableRec: batch.addUnusableRecord(record, undefined, `invalid record (${record})`, context)}]);
  }

  const messageOutcome = Try.try(() => copy(record, deep));

  // Add the "message" or unusable record to the batch
  return messageOutcome.map(
    message => {
      return [batch.addMessage(message, record, undefined, context)];
    },
    err => {
      return [{unusableRec: batch.addUnusableRecord(record, undefined, err.message, context)}];
    }
  ).toPromise();
}
function useStreamEventRecordAsMessage ( record , batch , extractMessageFromRecord , context ) { if ( ! record || typeof record !== 'object' ) { context . warn ( ` ${ record } ` ) ; return Promise . resolve ( [ { unusableRec : batch . addUnusableRecord ( record , undefined , ` ${ record } ` , context ) } ] ) ; } const messageOutcome = Try . try ( ( ) => copy ( record , deep ) ) ; // Add the "message" or unusable record to the batch return messageOutcome . map ( message => { return [ batch . addMessage ( message , record , undefined , context ) ] ; } , err => { return [ { unusableRec : batch . addUnusableRecord ( record , undefined , err . message , context ) } ] ; } ) . toPromise ( ) ; }
noinspection JSUnusedLocalSymbols 
A default `extractMessagesFromRecord` function that uses a copy of the given stream event record as the message
object & adds the message, rejected message or unusable record to the given batch.
@see ExtractMessagesFromRecord
@param {StreamEventRecord} record - a stream event record
@param {Batch} batch - the batch to which to add the extracted messages (or unusable records)
@param {undefined} [extractMessageFromRecord] - not used
@param {StreamProcessing} context - the context
@return {Promise.<MsgOrUnusableRec[]>} a promise of an array containing a message (copy of the record), a rejected message or an unusable record
noinspection JSUnusedLocalSymbols A default extractMessagesFromRecord function that uses a copy of the given stream event record as the message object & adds the message rejected message or unusable record to the given batch .