{"_id":"@arqex/ors","_rev":"2-368c15aa132d0920d79367e69e368da7","name":"@arqex/ors","dist-tags":{"latest":"0.9.0"},"versions":{"0.8.0":{"name":"@arqex/ors","version":"0.8.0","description":"The eventful state holder","main":"src/ors.js","scripts":{"test":"jest","test:watch":"jest --watch","coverage":"jest --coverage","coveralls":"jest --coverage && cat ./tests/coverage/lcov.info | coveralls","build":"node ./utils/build.js"},"repository":{"type":"git","url":"git+https://github.com/arqex/ors.git"},"keywords":["state-management","react","events","immutable","observable"],"author":{"name":"Javier Marquez - javi@arqex.com"},"license":"MIT","bugs":{"url":"https://github.com/arqex/ors/issues"},"homepage":"https://github.com/arqex/ors","devDependencies":{"coveralls":"^3.1.0","jest":"^26.4.2","rimraf":"^3.0.2","uglify-es":"^3.3.9"},"dependencies":{},"gitHead":"ecb4bf4743719b033338357a939372209cce4d7b","_id":"@arqex/ors@0.8.0","_nodeVersion":"14.4.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-MCU/s5iI1F+7Kp/8wbUpW1Uj18i1XjR3+0lAU0OkIB15dfQqj83QMXj5It11VZYGXvApS2EzIDD+uc3BN8324Q==","shasum":"e34909d1b9686d0fa2157a6ef151e1e482366f1f","tarball":"https://registry.npmjs.org/@arqex/ors/-/ors-0.8.0.tgz","fileCount":7,"unpackedSize":23116,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfb4sKCRA9TVsSAnZWagAAEdIP/idMwrR8/v52Kn6/K1T0\n8N5LZRPghu5HtSL8DEokInShFQA07Ad10eol/fJom356kaTLB13TSxNd0HP4\nrk4SbONzQY09K3kXmRqIHG5uJpFmLozcVmcFP8aTx6yMkVXKct4BPSNtxGxd\nMwNh9q8t4UC8mF1shkZalbu9LE9GXwM6xQsusHQ4xvAyRf/V6lzDIBDdLXJT\nV52s5QyZYsoQQC+IzGkyHHkD8YxSmDwBeULvCmKaaB+Ggywwxz2oy5cRQdNI\nSTsPy/jFu5Pj4wOpPdBmzFeY0u+wkgwgtpRl3JdQgymL/duRM5SOIW9JVBoN\nwy1bI5Jdnz+izNFFM2ivQdoAgXHpMSA3rX9x3Wp2Lwavnl7wKT3EO1lLSNXD\nLVSjpto6R9YcR9czEw0KJdw+0EHAMZc8BefEcrx9wg7Tvx8Lr9VzHzqyo45w\nL6xBTwqrdsLZCi5EP/A51bOR3ozlXP8SJ94QFrJ7D66TT5WojHYLL+ozF6rE\nwd4Zuz8OmpgnUZg+rw3Fe0e2WoSFo7nT8Sj89nHRy1BB6jaDg5tP0/Cf5Oid\nTkpt1O0QuJOESVFbSFPcAIfVBqHJzIS9LL0BE+LZVvescDQ0FtkZf2thqEkj\nlJgoTCXwzPMsOrxvV0TlGmZsI/P0GMBc7P81cySBoeqCaVJgat3WwL8kxVDy\na4+k\r\n=tvN4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCt+MRWxeuq15p42rqC6SthpmOpuWO5GlLVS97tLpdkzAIhANKXBMaAYglzRDNI6rHQoyxoaGvEwfgjGoPxvpZ6oxLq"}]},"maintainers":[{"name":"arqex","email":"javi@arqex.com"}],"_npmUser":{"name":"arqex","email":"javi@arqex.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ors_0.8.0_1601145609863_0.357987140601725"},"_hasShrinkwrap":false},"0.9.0":{"name":"@arqex/ors","version":"0.9.0","description":"The eventful state holder","main":"src/ors.js","scripts":{"test":"jest","test:watch":"jest --watch","coverage":"jest --coverage","coveralls":"jest --coverage && cat ./tests/coverage/lcov.info | coveralls","build":"node ./utils/build.js"},"repository":{"type":"git","url":"git+https://github.com/arqex/ors.git"},"keywords":["state-management","react","events","immutable","observable"],"author":{"name":"Javier Marquez - javi@arqex.com"},"license":"MIT","bugs":{"url":"https://github.com/arqex/ors/issues"},"homepage":"https://github.com/arqex/ors","devDependencies":{"coveralls":"^3.1.0","jest":"^26.4.2","rimraf":"^3.0.2","uglify-es":"^3.3.9"},"dependencies":{},"gitHead":"799bef30e6c5b09a0bd7f816ce48ac3c7a978abe","_id":"@arqex/ors@0.9.0","_npmVersion":"6.4.1","_nodeVersion":"10.14.2","_npmUser":{"name":"arqex","email":"javi@arqex.com"},"dist":{"integrity":"sha512-Q45hni9qNndXVVTPYZURnnyhmefawk4BTiZ7eewwgtqBKqrC4xt7jZRBLU1b2VRFR9UbHoi8tI+pCgOk/p6xIA==","shasum":"111c75b53b335a2c66abe693a640ac0b5a60461b","tarball":"https://registry.npmjs.org/@arqex/ors/-/ors-0.9.0.tgz","fileCount":7,"unpackedSize":28814,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqEQICRA9TVsSAnZWagAA680P/1TH07gCyot3zauCU1p5\nOlUj2V6y0UweDNeX7ROwh39YyfD8s7jizdvltszfciWnHnLbrigjmKjZtKKM\nxAMmxpj3wz1LFJBYkjuzvNvC3aEjTqa7VJYFm82pEo2Mjg55me23lteyKUtl\n/FbGjwUiQkzSy5vJN4mw8tpC7AbQRSncOhoaSDEmYkGzFHo3SQ8Hvzrbw6lA\nL49GFmY7qR6JZLTte/057GMR2pmU78bup1rWIFM4yesphxHG2d1WsVSCb1ae\nGyWMZsrrEVSypNwss9U0zk3vthVBrYhVdwozB6o+Sl/jk4AKwivedJc+0R/G\n6zc+ONzrLxx8PMnMuFv7jSSnttK/S26uSVIM54lRxugYGjIbhs/6BO5MP6hm\nMoRwT2bZ/vsw4i+QHQD63FaMP2iRJ0FZ8EN+kIixWOwrMSnjUEDzUb5B32zK\ndeJlO32fwgMRE54lhAL336OkfmUyDDGpRKCkBygeudiUfRJfbIgyz3VqhXCL\ncO/gtfSqSn9q2AKPTEM6D6dPVdBa+0ynDVNTmFBzSi+6ZwkWdh00FbYXt0ZJ\nJl1Uv1dkV5hO97JzwfCk6bSW04nT+56EY9XZ6kIFMvLUAmZ3IQbXYMjGofNt\nyr+Bid040/6MoBqkyILNeJhQuZQPCrFpi1JSObrEE6wOj6YT3X/HSS5dU3H5\n0Wx7\r\n=E0hr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9lFwyYBOSCceIpks0qcjQ2QRoYQlNTxAVJrXnpWdUbAIhAL9Aha2i+vI1zK+2xPnQIn8e8Aauo6rvxoqNGp4gWQFz"}]},"directories":{},"maintainers":[{"name":"arqex","email":"javi@arqex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ors_0.9.0_1604862983737_0.6774193940388205"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-26T18:40:09.820Z","0.8.0":"2020-09-26T18:40:10.038Z","modified":"2022-04-04T15:34:14.085Z","0.9.0":"2020-11-08T19:16:23.862Z"},"maintainers":[{"name":"arqex","email":"javi@arqex.com"}],"description":"The eventful state holder","homepage":"https://github.com/arqex/ors","keywords":["state-management","react","events","immutable","observable"],"repository":{"type":"git","url":"git+https://github.com/arqex/ors.git"},"author":{"name":"Javier Marquez - javi@arqex.com"},"bugs":{"url":"https://github.com/arqex/ors/issues"},"license":"MIT","readme":"# ORS - Observable regenerating store\r\n\r\n[![npm version](https://badge.fury.io/js/ors.svg)](https://www.npmjs.com/package/ors) [![Build Status](https://secure.travis-ci.org/arqex/ors.svg)](https://secure.travis-ci.org/arqex/ors) [![Coverage Status](https://coveralls.io/repos/github/arqex/ors/badge.svg?branch=master)](https://coveralls.io/github/arqex/ors?branch=master)\r\n\r\nThe Observable Regenerating Store is a tree data structure that emits events when it's updated, even if the change happens in one of the leaves, making easier to think in a reactive way.\r\n\r\nAn *ORS* can be read or updated like any JS object:\r\n```js\r\nimport ors from '@arqex/ors'\r\n\r\nlet store = ors({\r\n  people: {\r\n    alice: { age: 22 },\r\n    bob: {age: 38}\r\n  }\r\n});\r\n\r\nstore.addChangeListener( () => console.log('Changed') );\r\n\r\nstore.people.alice.age = 23; // Will print 'Changed' in the console!\r\n```\r\n[See this example working](https://codesandbox.io/s/cool-chatelet-njg9j?file=/src/index.js)\r\n\r\nORS is intended to be the single store where centralize all the data of a JavaScript application, it's the simplest way of manage the state: Just use it and listen to changes to update your UI. See how it works.\r\n\r\n## Installation\r\n```sh\r\nnpm install --save @arqex/ors\r\n```\r\n\r\n## Usage\r\n```js\r\n// Import the library\r\nimport ors from '@arqex/ors'\r\n\r\n// Create a store\r\nlet store = ors({\r\n  people: {\r\n    alice: { age: 12, children: [] },\r\n    bob: { age: 38, children: ['alice']  }\r\n  }\r\n});\r\n\r\n// We can read from the store like if it was a standard JS object\r\nlet alice = store.people.alice;\r\nconsole.log( alice.age ); // prints out 12\r\n\r\n// Listen to changes\r\nstore.addChangeListener( () => console.log('Store updated') );\r\n\r\n// We can listen to changes in any node\r\nstore.people.bob.addChangeListener( () => console.log('Bob updated') );\r\n\r\n// Updates can be done like if it was a standard JS object\r\nstore.people.bob.children.push('chris'); // This will emit events\r\n\r\nconsole.log( store.people.bob.children[1] ); // Prints out > 'chris'\r\n\r\n// Multiple updates in the same cycle are batched and they\r\n// will emit events just once\r\nstore.people.bob.age = 39;\r\n\r\n//... on the following tick, events are emitted so the console print out\r\n//    in ascending order:\r\n// > 'Bob updated'\r\n// > 'Store updated'\r\n```\r\n[See this example working](https://codesandbox.io/s/elated-golick-05mvw?file=/src/index.js)\r\n\r\n## How does ORS work?\r\n\r\nORS has 3 main features. They are probably all the features it has and that makes it simple and powerful.\r\n\r\n### Feature 1: It looks like a standard JS object\r\n\r\nORS is really simple to use because we don't need to learn any methods or strategy to make it work. It loks like just any other object:\r\n\r\n```js\r\nlet store = ors({\r\n  people: [\r\n    {name: 'Jude', age: 20}\r\n  ];\r\n});\r\n\r\n// We can access the data like if it was a standard JS object:\r\nstore.people[0].name; // Jude\r\n\r\n// We can update it as we update any other object\r\nstore.people[0].age = 21;\r\nstore.people[0].age; // 21\r\n\r\n// We can use all array methods\r\nlet jude = store.people.pop();\r\njude; // {name: 'Jude', age: 21}\r\nstore.people.length; // 0\r\n```\r\n\r\nThe stores look like JS standard objects, but they really aren't. Objects and arrays are used as baseIn the background, it uses JS Proxies to keep track of the changes and spread them up through the store.\r\n\r\n but it regenerates when a node gets updated and emit change events.\r\n\r\n\r\nIt has some features that makes it the simplest way of managing the state:\r\nIt looks like a standard JS object.\r\nIt's completely observable. We can listen for updates at any node, and change events are triggered in the parent nodes when children are updated.\r\nWhen a child is updated, the whole branch that contains it gets regenerated after the change event, making simpler to use memoization to derive data.\r\n\r\n\r\n## Usage\r\nTo be documented...\r\n\r\n## Compatibility\r\nThese are the **minimum browser versions** to make ORS work:\r\n<table>\r\n  <tr>\r\n    <td>Chrome</td>\r\n    <td>Firefox</td>\r\n    <td>Edge</td>\r\n    <td>IE</td>\r\n    <td>Safari</td>\r\n  </tr>\r\n  <tr>\r\n    <td>49</td>\r\n    <td>18</td>\r\n    <td>12</td>\r\n    <td>Won't work</td>\r\n    <td>10</td>\r\n  </tr>\r\n</table>\r\n\r\n **Mobile browsers**:\r\n<table>\r\n  <tr>\r\n    <td>Android</td>\r\n    <td>Chrome</td>\r\n    <td>iOS Safari</td>\r\n    <td>Samsung</td>\r\n    <td>Opera</td>\r\n  </tr>\r\n  <tr>\r\n    <td>49</td>\r\n    <td>49</td>\r\n    <td>10</td>\r\n    <td>6.2</td>\r\n    <td>30</td>\r\n  </tr>\r\n</table>\r\n\r\nOn **Node.js** it works **since version 6.5**.\r\n","readmeFilename":"README.md"}