lib/data-store/resource.js
function Resource (path, name, data) {
  switch (arguments.length) {
    case 0:
      this.collection = "";
      this.name = "/";
      this.data = undefined;
      break;
    case 1:
      this.collection = getCollectionFromPath(path);
      this.name = getNameFromPath(path);
      this.data = undefined;
      break;
    case 2:
      this.merge(name);
      this.collection = getCollectionFromPath(path);
      this.name = getNameFromPath(path);
      break;
    default:
      this.collection = normalizeCollection(path);
      this.name = normalizeName(name);
      this.merge(data);
  }

  this.createdOn = null;
  this.modifiedOn = null;
}
function Resource (path, name, data) {
  switch (arguments.length) {
    case 0:
      this.collection = "";
      this.name = "/";
      this.data = undefined;
      break;
    case 1:
      this.collection = getCollectionFromPath(path);
      this.name = getNameFromPath(path);
      this.data = undefined;
      break;
    case 2:
      this.merge(name);
      this.collection = getCollectionFromPath(path);
      this.name = getNameFromPath(path);
      break;
    default:
      this.collection = normalizeCollection(path);
      this.name = normalizeName(name);
      this.merge(data);
  }

  this.createdOn = null;
  this.modifiedOn = null;
}
function Resource ( path , name , data ) { switch ( arguments . length ) { case 0 : this . collection = "" ; this . name = "/" ; this . data = undefined ; break ; case 1 : this . collection = getCollectionFromPath ( path ) ; this . name = getNameFromPath ( path ) ; this . data = undefined ; break ; case 2 : this . merge ( name ) ; this . collection = getCollectionFromPath ( path ) ; this . name = getNameFromPath ( path ) ; break ; default : this . collection = normalizeCollection ( path ) ; this . name = normalizeName ( name ) ; this . merge ( data ) ; } this . createdOn = null ; this . modifiedOn = null ; }
Represents a single REST resource, such as a web page, a file, a piece of JSON data, etc.
Each Resource is uniquely identifiable by its collection and its name.

Examples:
/static/pages/index.html
- Collection: /static/pages
- Name: /index.html

/restaurants/washington/seattle/
- Collection: /restaurants/washington
- Name: /seattle/

/restaurants/washington/seattle/joes-diner
- Collection: /restaurants/washington/seattle
- Name: /joes-diner
/
- Collection: (empty string)
- Name: /


@param   {string}    [path] - The full resource path (collection and name), or just the collection path
@param   {string}    [name] - The resource name (if `path` is just the collection path)
@param   {*}         [data] - The resource's data
@constructor
Represents a single REST resource such as a web page a file a piece of JSON data etc . Each Resource is uniquely identifiable by its collection and its name .