{"_id":"@_agco/stateful","_rev":"3-8efd29cdd25a19d21f678c676ed1d047","name":"@_agco/stateful","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@_agco/stateful","version":"1.0.0","description":"a promise based predictable state container","main":"index.js","license":"MIT","repository":{"type":"git","url":"git+https://bitbucket.org/_agco/stateful.js.git"},"authors":[{"name":"Ajay Gupta","email":"ajay.gupta8308@gmail.com","url":"https://github.com/itsag"},{"name":"Gatha Site","email":"gatha.site@gmail.com","url":"https://github.com/gathasite"}],"scripts":{"release":"grunt"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","grunt":"^1.0.3","grunt-babel":"^8.0.0","jshint":"^2.9.7","load-grunt-tasks":"^4.0.0"},"keywords":["stateful","state","predictable","functional","immutable"],"publishConfig":{"access":"public"},"gitHead":"cf3082e68c7e32e7cab068eb5f00c7b7e8fd3c26","homepage":"https://bitbucket.org/_agco/stateful.js#readme","_id":"@_agco/stateful@1.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-FaDkjkpNK5jiN5N7R25wRnt0q7Q6CGDNx4/9/cT0z3GLXwCXS//hXaOig6pabzuByDHdFXO8o12WieWlWj5V3Q==","shasum":"d720e0799b93ec4afc92b16a2640ebb68dfb0ebc","tarball":"https://registry.npmjs.org/@_agco/stateful/-/stateful-1.0.0.tgz","fileCount":5,"unpackedSize":20976,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdPeoUCRA9TVsSAnZWagAATRkP/i8/fhBAKQ/GgcpPurc0\nYOrsMTRY/+zWIHxVIlpiLz0Z1pXjR2HzmTq/50HPFTzPsDgYTLXG1dUH/fWY\nem4Ljg89EqVfb252XXZi2ribuTGhY1XSuYvCoN7wbWz5ODutw0FfGbixRwwH\nEbSALMtOl1+SQz/n1DYAynSFRk6vaI85C9sSBVHA1VBhRJANejTJU3SjYaHx\niK7OKVp0Jc7oF3gfR+QOkijUVdCIeAIhmXx77vFq5U9hQ9Qrv959KBmRvpOP\n7hsLQVOwvFD0U93H3Fs3AEZpn3YBmJfr5gbxqrSy9vlE1LzGdcQId2C88wl1\nrFKubm7ZElt6biJCFcW1yYYMhQbldsHcRblYCo3TV/0avTp4n8ICMQNedatt\nKjjeZm77MDvVa/5qQ/mqcY5iDoQXpXTNcykDuT0+3EbGP07ryGMRCfE1lcB8\nA/13i3d9rslNr91Qoftuwt5QYU3xycarcBYIjzo+Cu8kA3KGsv6esReKk0rS\nWHNtL+stXpJ8KiNXINrzJBtA2ur6WMmy6t3hpTUKuWpKFkJeMvB5WCy3ZjXP\nR8jku6BYiS7hFAER3S+ZD4QGNLxsbM9C8SAhlmWJchcQATM3L+f+zphjtn7u\nCCb8Vf0kmyTlcaVm/E2GwfVoLXIiZ3sUahUqxMzt4F+W1adsUTTwbso36gmn\nDXvq\r\n=uChD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDU8J7Q04lQy6qZcwJ2Elof6yLmnnRDZwwYBVLf8c6PfwIhAODBgmqZ3MZYJcVKfDHvpm/CC7A0Qw8Mic66ak6HyNCu"}]},"maintainers":[{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"}],"_npmUser":{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stateful_1.0.0_1564338707511_0.11033121838456106"},"_hasShrinkwrap":false},"1.0.1":{"name":"@_agco/stateful","version":"1.0.1","description":"a promise based predictable state container","main":"index.js","license":"MIT","repository":{"type":"git","url":"git+https://bitbucket.org/_agco/stateful.js.git"},"authors":[{"name":"Ajay Gupta","email":"ajay.gupta8308@gmail.com","url":"https://github.com/itsag"}],"scripts":{"release":"grunt"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","grunt":"^1.0.3","grunt-babel":"^8.0.0","jshint":"^2.9.7","load-grunt-tasks":"^4.0.0"},"keywords":["stateful","state","predictable","functional","immutable"],"publishConfig":{"access":"public"},"gitHead":"a1d03760b3b8e5252799f4d8995bd6244d9c8201","homepage":"https://bitbucket.org/_agco/stateful.js#readme","_id":"@_agco/stateful@1.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-TVrUIw2RsX6XOH2L705gO2P4jk2lhEvQVt6m6Uu5YL7qhoK+K2ebYhlzQrUM2QS5RTHgcVzx5N5064B6mt1QzA==","shasum":"d5021cf08a249e4c491dc9598e9a1ab075a2aa3d","tarball":"https://registry.npmjs.org/@_agco/stateful/-/stateful-1.0.1.tgz","fileCount":5,"unpackedSize":20798,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdRVIhCRA9TVsSAnZWagAAdlYP/iq6jmz/rCzvPPen9Eg8\npsEowoZ3jhDiecEEKssSshLBmBWIjxjSIiyJjuwzWpFbJt3P/W3a1raSpP2B\nkGchzQi5Nsql65ypFJzB1dTJ+gUXtlkBKiwR8ghQrXK6nwNWCfO+vR0tfimr\npNsWvY0aq77UKe5fX7NMWRlFdKAI9go8Q706myVIfbpTrGUMYaxa6Q4V6bce\ndetlg9RbPC3+nPYDh6dW+HT2MS3im26fwma88TyFkm9/HSSOobbrhTbqFtqx\nakD87vo8c9fb3kB7sFJHBv5TmwtH5asAU2bMp1wfxHp2LzOoNMsl5ClkqZQ/\nyrq0G83aHaKc+ErqNnfbtULmHIMW6fKgtUtwR7sFIRlBR+6lJWpG+SMxOCkl\nbEom4scoOGWBd6XCZU4s/aX6jA2iyRI5ostm5/6yc6a2lJL0YAcmormwNjqW\nniAEcwObZP6NLqAyiUfG2Ma2AMHwlpdaioDgqByq3Izcg5F8o30+1bVHFfqa\ntGXnbdJakmtb30dFFZ5cZ+sd6cMi4ITXi4mYGwsy7aE780q4UBP0c+dt7mSH\nwhcvvOwSOGI2nKJ/Qi4zm9ruQ2VMVQKUZSNfg7crK7fvR1H+OcXi26jL5TNL\nobQuf2hIC6feO8mcVeIr8S70Ydme4oPIJdFrvIQi6YfcoUuKDm1IToxfHErC\nnJ3/\r\n=Yg3T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEnRPPAXjoWl69nFkDsrwkBauSNfuVv9AP+0z8/7f4FUAiA8sOHLjitLfn6/8X6gBNmg1n4T3GIGAKOT0BV/nxiixg=="}]},"maintainers":[{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"}],"_npmUser":{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stateful_1.0.1_1564824096901_0.66762096397494"},"_hasShrinkwrap":false},"1.0.2":{"name":"@_agco/stateful","version":"1.0.2","description":"a promise based predictable state container","main":"index.js","license":"MIT","repository":{"type":"git","url":"git+https://bitbucket.org/_agco/stateful.js.git"},"authors":[{"name":"Ajay Gupta","email":"hi@ajaygupta.co","url":"https://ajaygupta.co"}],"scripts":{"release":"grunt"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","grunt":"^1.0.3","grunt-babel":"^8.0.0","jshint":"^2.9.7","load-grunt-tasks":"^4.0.0"},"keywords":["stateful","state","predictable","functional","immutable"],"publishConfig":{"access":"public"},"gitHead":"64c2ba53ce79b15edd643349af52b1fa16484e98","homepage":"https://bitbucket.org/_agco/stateful.js#readme","_id":"@_agco/stateful@1.0.2","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-4WEV3aFfLSJ/MRM6xVjMdM7xGjJpKt2tOszLfZ4yZOGk4IzgYKCiLb7icoIqAzs7sPpWByyhLsIHQAE//Q82eg==","shasum":"7b147a24a81acb3a90961ffc22b1c7f26ad299b8","tarball":"https://registry.npmjs.org/@_agco/stateful/-/stateful-1.0.2.tgz","fileCount":5,"unpackedSize":20785,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdXvejCRA9TVsSAnZWagAAdbIP/1qw9GGcXnNhcgftBTBL\n6XE+WiCu8xEQkE6IdcWMHVsSmZnYNW1QOE6pYK5ExRMdGWu1uXPrpYW/42IJ\nXpJokeQZo2Zr9VO95eUKJ9WwEgdEj/6aYTz+f8Xm+j5hamjLgPdPLCLhVRXz\n/sFC40k2JVV+EU/vRjTY7VB3l8Rix39xB4EAiIRUI74aX8UoK+8my7wjwbgb\noVJC2v1Pr/N8AYiLhuOZFtpP85/TMMiPss0YDb3bzluZGF121kbEXD1lLQho\ngW/ZDLn2jgbufpw5oVxyumJFETJ2Ar9hmqcFCWuyCCfIdVirP3D9c0n/dSiS\nGmvFwDQxBs3mVfKP4IcqCa8Ad96Kb/bZtQb/MIkOxzpFPsPD+iHLtPfwwrCt\n0w/I5Loa52yMZo6LPxzRS9/YtXzViK2b2X8wrs90jgQ/vV1dsjyrNB7ekjnT\nxZtS4zYhD+EgJ7rpcCwkd+lD6IBrEm3St2LS/WAOtyzHVtWU+RCfR7LSMR7K\nXWdUaUfgFH3XVgOkJ5TaqvynMq4f7OPmzKNexGpzFLdIpLgr1tTwbDmbFjR9\n3jzglwW7ugqhTeCjKjbUQjI7NhxU4K6Jyw2wP+4bBMXzRZ7l8Hpg8pYoOvu7\nyEffXW4k0R9K8l3lxcTYg+NGdv5RQnaFcg8wA9XJ1Rf7Hq69gfNXeT2jZPZW\n0xp8\r\n=LFlf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBWLkFG9hGC31ewc73ef4vB3maOfKEkLmSI/9ehDjV/xAiEArj2TuQhfbvsposNGMwejkITVhq8LslEhMzBsYovkQxk="}]},"maintainers":[{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"}],"_npmUser":{"name":"_ajaygupta","email":"hi@ajaygupta.co"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stateful_1.0.2_1566504867167_0.46097918761190804"},"_hasShrinkwrap":false}},"time":{"created":"2019-07-28T18:31:47.292Z","1.0.0":"2019-07-28T18:31:47.655Z","modified":"2022-04-04T10:51:25.532Z","1.0.1":"2019-08-03T09:21:37.144Z","1.0.2":"2019-08-22T20:14:27.314Z"},"maintainers":[{"name":"_ajaygupta","email":"ajay.gupta8308@icloud.com"}],"description":"a promise based predictable state container","homepage":"https://bitbucket.org/_agco/stateful.js#readme","keywords":["stateful","state","predictable","functional","immutable"],"repository":{"type":"git","url":"git+https://bitbucket.org/_agco/stateful.js.git"},"license":"MIT","readme":"# Stateful.js\n\n_**Simple. Predictable. Promise-ful.**_ <br> Stateful is a promise based predicate data store. It requires almost zero-setup and provides a simple API to interact with the created \"Pools\".\n\n---\n\n## What's a Pool?\n\nA pool is an object that can store any type of data as a key-value pair. For example, a pool named \"Todos\" can be created to store a list of Todos. A pool has access to a number of methods that are used to add, update or remove data from the pool. Every value in the pool must have a key even if the payload is empty.\n\n---\n\n## Installation\n\nInstall using a package manager such as Yarn:\n\n```shell\nyarn add @_agco/stateful\n```\n\n---\n\n## Usage\n\nThe library exposes simple APIs for data manipulation and management:\n\n```js\n// Modules\nimport { Pool } from \"@_agco/stateful\";\n\n// Pools\nconst Todos = new Pool({ name: \"Todos\" });\n```\n\nThis will create a Pool named \"Todos\" in the global state tree. Now we can utilize this pool to store and update data by using its prototypes:\n\n---\n\n### get(key: string | array)\n\n- Returns the data in the pool.\n- Accepts a parameter `key` which can be a string or an array of keys i.e. `Array<string>`\n- It returns a promise, and the successful response is the requested data.\n\n```js\n// Get all pool properties\nTodos.get().then(state => {\n  // statements\n});\n\n// Get a specific property\nTodos.get(\"todo1\").then(state => {\n  // statements\n});\n\n// Get multiple properties\nTodos.get([\"todo1\", \"todo2\", \"todoN\"]).then(state => {\n  // statements\n});\n```\n\n---\n\n### update(key: string | array: required, payload: any)\n\n- Adds or Updates the data in the pool.\n- Accepts two parameters, a `key` and a `payload`.\n- The `key` can be a string or an array of objects i.e. `{ key, payload }`, where key is required.\n- It returns a promise, and the successful response is the snapshot of the updated pool.\n\n```js\n// Add a property to the pool\nTodos.update(\"amount\", 1000).then(newstate => {\n  // statements\n});\n\n// Add multiple properties to the pool\nTodos\n  .update([\n    { key: \"todo1\", payload: \"buy grocery\" },\n    { key: \"todo2\", payload: \"dinner with mom\" }\n  ]).then(newstate => {\n  // statements\n  });\n```\n\n---\n\n### has(key: string: required)\n\n- Checks whether a property exists in the pool.\n- It returns the value of the property if it exists, otherwise, returns false.\n\n```js\n// Check if \"todo1\" exists in pool\nTodos.has(\"todo1\"); // returns {...} or false\n```\n\n---\n\n### remove(key: string OR regex: required)\n\n- Removes one or more properties by passing the key as a parameter.\n- It returns a promise, and the successful response is the snapshot of the updated pool.\n\n```js\n// Remove a specific property\nTodos.remove(\"todo\").then(newstate => {\n  // statements\n});\n\n// Remove multiple properties using regex\nTodos.remove(/todo_i/).then(newstate => {\n  // statements\n});\n```\n\n---\n\n### reset()\n\n- Empties the pool\n\n```js\n// Empty the pool\nTodos.reset(); // returns {}\n```\n\n---\n\n### subscribe(method: function: required)\n\n- Registers a callback which will be exectued whenever the pool is updated.\n\n```js\n// assign a method to be called when the pool is updated.\nTodos.subscribe(() => {\n  // statements\n});\n```\n","readmeFilename":"README.md"}