lib/resource.js
function Resource(spec, options) {
  if (!(this instanceof Resource)) {
    return new Resource(spec, options);
  }

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

  debug('create resource %s', spec.path, spec);

  this.spec = spec;
  this.list = [];
  this.options = options || {};

  this.middleware = {};
  this.operations = {};
}
function Resource(spec, options) {
  if (!(this instanceof Resource)) {
    return new Resource(spec, options);
  }

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

  debug('create resource %s', spec.path, spec);

  this.spec = spec;
  this.list = [];
  this.options = options || {};

  this.middleware = {};
  this.operations = {};
}
function Resource ( spec , options ) { if ( ! ( this instanceof Resource ) ) { return new Resource ( spec , options ) ; } if ( typeof spec !== 'object' ) { throw new Error ( 'resource spec must be an object' ) ; } debug ( 'create resource %s' , spec . path , spec ) ; this . spec = spec ; this . list = [ ] ; this . options = options || { } ; this . middleware = { } ; this . operations = { } ; }
Initialize a new `Resource`.

@param {Object} spec
@param {Object} options
@api public
Initialize a new Resource .