1 | # hadron-document [![][travis_img]][travis_url] [![][npm_img]][npm_url]
|
2 |
|
3 | Hadron Document is a wrapper for javascript objects that represent documents
|
4 | in a database intended for use with React components. It provides element
|
5 | (key/value pair) level dirty tracking with the ability to add, edit, delete
|
6 | and revert changes to elements directly.
|
7 |
|
8 | ## Installation
|
9 |
|
10 | ```
|
11 | npm install --save hadron-document
|
12 | ```
|
13 |
|
14 | ## Usage
|
15 |
|
16 | ```javascript
|
17 | 'use strict';
|
18 |
|
19 | const Document = require('hadron-document');
|
20 |
|
21 | var object = {
|
22 | _id: 'aphex-twin',
|
23 | name: 'Aphex Twin',
|
24 | locations: [ 'London' ],
|
25 | emails: {
|
26 | home: 'home@aphextwin.com',
|
27 | work: 'work@aphextwin.com'
|
28 | }
|
29 | }
|
30 |
|
31 | var doc = new Document(object);
|
32 | ```
|
33 |
|
34 | ## License
|
35 |
|
36 | Apache 2.0
|
37 |
|
38 | [travis_img]: https://img.shields.io/travis/mongodb-js/hadron-document.svg?style=flat-square
|
39 | [travis_url]: https://travis-ci.org/mongodb-js/hadron-document
|
40 | [npm_img]: https://img.shields.io/npm/v/hadron-document.svg?style=flat-square
|
41 | [npm_url]: https://www.npmjs.org/package/hadron-document
|