lib/Pass.js
function Pass(style, fields, opts, cb) {
  Stream.call(this)

  // Get our own shallow copy of the fields
  this.fields = _.extend({}, fields)
  this.style  = style
  this.opts   = opts

  if (!this.fields[style]) {
    this.fields[style] = {}
  }

  // Copy structure fields to style
  if (this.fields.structure) {
    this.fields[style] = this.fields.structure
  }

  // Structure no longer needed
  delete this.fields.structure

  // setup images and certs
  this._setupImages()
  this._setupCerts(opts.certs)

  // Transform relevantData to ISO Date if its a Date instance
  if (fields.relevantDate instanceof Date) {
    fields.relavantDate = fields.relavantDate.toISOString()
  }

  // Validate pass fields and generate
  this.validate()
  this.cb = cb
  process.nextTick(this._generate.bind(this))
}
function Pass(style, fields, opts, cb) {
  Stream.call(this)

  // Get our own shallow copy of the fields
  this.fields = _.extend({}, fields)
  this.style  = style
  this.opts   = opts

  if (!this.fields[style]) {
    this.fields[style] = {}
  }

  // Copy structure fields to style
  if (this.fields.structure) {
    this.fields[style] = this.fields.structure
  }

  // Structure no longer needed
  delete this.fields.structure

  // setup images and certs
  this._setupImages()
  this._setupCerts(opts.certs)

  // Transform relevantData to ISO Date if its a Date instance
  if (fields.relevantDate instanceof Date) {
    fields.relavantDate = fields.relavantDate.toISOString()
  }

  // Validate pass fields and generate
  this.validate()
  this.cb = cb
  process.nextTick(this._generate.bind(this))
}
function Pass ( style , fields , opts , cb ) { Stream . call ( this ) // Get our own shallow copy of the fields this . fields = _ . extend ( { } , fields ) this . style = style this . opts = opts if ( ! this . fields [ style ] ) { this . fields [ style ] = { } } // Copy structure fields to style if ( this . fields . structure ) { this . fields [ style ] = this . fields . structure } // Structure no longer needed delete this . fields . structure // setup images and certs this . _setupImages ( ) this . _setupCerts ( opts . certs ) // Transform relevantData to ISO Date if its a Date instance if ( fields . relevantDate instanceof Date ) { fields . relavantDate = fields . relavantDate . toISOString ( ) } // Validate pass fields and generate this . validate ( ) this . cb = cb process . nextTick ( this . _generate . bind ( this ) ) }
Generates a pass over a streaming interface or optionally a callback

@param {String}   style  Style of the pass
@param {Object}   fields Pass fields
@param {Object}   opts   Extra options
@param {Function} cb     Callback function
Generates a pass over a streaming interface or optionally a callback