lib/operation.js
function Operation(spec, options, fn) {
  if (typeof options === 'function') {
    fn = [].slice.call(arguments).slice(1);
    options = {};
  } else if (Array.isArray(options)) {
    fn = options;
    options = {};
  } else if (!Array.isArray(fn)) {
    fn = [].slice.call(arguments).slice(2);
  }

  if (!(this instanceof Operation)) {
    return new Operation(spec, options, fn);
  }

  if (typeof spec !== 'object') {
    throw new Error('operation spec must be an object');
  }

  debug('create operation', spec);

  this.spec = spec;
  this.options = options || {};
  this.fn = fn;
  this.middleware = {};
}
function Operation(spec, options, fn) {
  if (typeof options === 'function') {
    fn = [].slice.call(arguments).slice(1);
    options = {};
  } else if (Array.isArray(options)) {
    fn = options;
    options = {};
  } else if (!Array.isArray(fn)) {
    fn = [].slice.call(arguments).slice(2);
  }

  if (!(this instanceof Operation)) {
    return new Operation(spec, options, fn);
  }

  if (typeof spec !== 'object') {
    throw new Error('operation spec must be an object');
  }

  debug('create operation', spec);

  this.spec = spec;
  this.options = options || {};
  this.fn = fn;
  this.middleware = {};
}
function Operation ( spec , options , fn ) { if ( typeof options === 'function' ) { fn = [ ] . slice . call ( arguments ) . slice ( 1 ) ; options = { } ; } else if ( Array . isArray ( options ) ) { fn = options ; options = { } ; } else if ( ! Array . isArray ( fn ) ) { fn = [ ] . slice . call ( arguments ) . slice ( 2 ) ; } if ( ! ( this instanceof Operation ) ) { return new Operation ( spec , options , fn ) ; } if ( typeof spec !== 'object' ) { throw new Error ( 'operation spec must be an object' ) ; } debug ( 'create operation' , spec ) ; this . spec = spec ; this . options = options || { } ; this . fn = fn ; this . middleware = { } ; }
Initialize a new `Operation`.

@param {Object} spec
@param {Object} options
@param {Function} fn
@api public
Initialize a new Operation .