# Introduction

![Travis build status](http://img.shields.io/travis/jamesplease/standard-resource.svg?style=flat) ![npm version](https://img.shields.io/npm/v/standard-resource.svg) ![Test Coverage](https://coveralls.io/repos/github/jamesplease/standard-resource/badge.svg?branch=master) ![gzip size](http://img.badgesize.io/https://unpkg.com/standard-resource/dist/standard-resource.min.js?compression=gzip)

A normalized data store.

✓ Works in Node or in the browser\
✓ Normalizes data\
✓ Flexible: define schemas for extra robustness, or choose not to\
✘ Sophisticated relationship support (*coming soon*)

## Installation

> Note: this library is not yet ready to be used.

Install using [npm](https://www.npmjs.com):

```
npm install standard-resource
```

or [yarn](https://yarnpkg.com/):

```
yarn add standard-resource
```

## Documentation

View the documentation at [**standard-resource.js.org ⇗**](https://standard-resource.js.org/).

## Quick Start

Follow this guide to get a taste of what it's like to work with Standard Resource.

First, we create a store. A store is where all of our resource data will be located.

```javascript
import createResourceStore from 'standard-resource';

const store = createResourceStore();
```

Next, we can add a resource to the store. Let's create add a book with an ID of "24":

```javascript
store.update('resources.books.24', {
  attributes: {
    name: 'The Lord of the Rings',
  },
});
```

Now that we have created our book, we can retrieve it.

```javascript
console.log(store.getResources('books', ['24']));
// [
//   {
//     id: '24',
//     attributes: { name: 'Lord of the Rings' },
//     meta: {},
//     computedAttributes: {}
//   }
// ]
```

This is just a small sample of what it's like working with Standard Resource.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://standard-resource.js.org/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
