json-api-store icon indicating copy to clipboard operation
json-api-store copied to clipboard

Add a describe() method for resource meta information

Open haydn opened this issue 9 years ago • 0 comments

var store = new Store();
store.define("products", {
  title: Store.attr(),
  category: Store.hasOne(),
  comments: Store.hasMany()
});
store.describe("products"); 
// {
//   fields: [ "title", "category", "comments" ],
//   attributes: [ "title" ],
//   relationships: [ "category", "comments" ],
//   hasOnes: [ "category" ],
//   hasManys: [ "comments" ],
//   pseudonyms: [ "products", "product" ]
// }

haydn avatar Oct 12 '15 01:10 haydn