{"_id":"evidence","_rev":"20-c3af6ceeb04d041646e30ced81ad6621","name":"evidence","description":"Track the history of an object.","dist-tags":{"latest":"1.0.3"},"versions":{"0.0.1":{"name":"evidence","version":"0.0.1","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"duplexer":"^0.1.1","objectstate":"^2.0.3","through":"^2.3.6"},"devDependencies":{"tape":"^3.5.0"},"gitHead":"9021d774ff98f7889e2b86ab4a6c579b504951d4","_id":"evidence@0.0.1","_shasum":"a920975ade17b95e8649bdc3cad55fcb37ec71de","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"a920975ade17b95e8649bdc3cad55fcb37ec71de","tarball":"https://registry.npmjs.org/evidence/-/evidence-0.0.1.tgz","integrity":"sha512-aVnDJy01/NtXasYcUPgTvrxAEMizrEWHE9eunxyyf7STkCBh3hTVpGhFYMiQABLOe9baEtC4tvxQOSWbN1zKOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICMKqCujmxbmkBIs93hTn4kWKnjl1XB8AFvklvMXHM/XAiEA9qGDwBMFInQCeGWB//se3suysJ1KqE9kHJiPwkJ7EHw="}]}},"0.1.0":{"name":"evidence","version":"0.1.0","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"duplexer":"^0.1.1","objectstate":"^2.0.3","through":"^2.3.6"},"devDependencies":{"tape":"^3.5.0"},"gitHead":"48eb4e95d7a3be727c1982aa681b20a91a4ffbbc","_id":"evidence@0.1.0","_shasum":"f66340c0e38e245c25e83b1c28774aaa312ad2d6","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"f66340c0e38e245c25e83b1c28774aaa312ad2d6","tarball":"https://registry.npmjs.org/evidence/-/evidence-0.1.0.tgz","integrity":"sha512-XPHzFc4JZ0jFPEC7H0fOozUetzYuJSlcZo210cA54KlRL1JQE/EGprqwloOPBeQPz2QLVo2a7er81mnBgSB1ng==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDaUqXxISAD17jPU+XUeGz/BrCx4yZzh9bBwZvqUqyRUgIgP3ksCBOF7ED96ck4SLRgh50lE1OUf1/+MrmVgnGod/c="}]}},"0.2.0":{"name":"evidence","version":"0.2.0","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"duplexer":"^0.1.1","objectstate":"^2.0.3","through":"^2.3.6"},"devDependencies":{"tape":"^3.5.0"},"gitHead":"ceaad08806878c194414e857a72972244c6cc539","_id":"evidence@0.2.0","_shasum":"cafd081f45314768b0ca9e2a25e3af137128e026","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.36","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"cafd081f45314768b0ca9e2a25e3af137128e026","tarball":"https://registry.npmjs.org/evidence/-/evidence-0.2.0.tgz","integrity":"sha512-EyQlxNmPWKzTSuw2Fl/FxAaOn9l8vn18dI/d77hn+mhUhhLTjkE1bQklD+X6UWkE0n5x6/l6hfIAbYAW9PtKnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHMANx8qWwz9ndvat2UbohAs3xJxxS8lRO+kK3Iv4wjJAiBgXXHy5Ca14u6SBz/op5g9LhrK2N82vT8iuhxvgwPc3w=="}]}},"0.3.0":{"name":"evidence","version":"0.3.0","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"tape":"^3.5.0"},"gitHead":"af248be360216b1926090df9c14b979f6a8b83b8","_id":"evidence@0.3.0","_shasum":"3da8ab590c1a96e10ec55945c08465ca0b2a1525","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.36","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"3da8ab590c1a96e10ec55945c08465ca0b2a1525","tarball":"https://registry.npmjs.org/evidence/-/evidence-0.3.0.tgz","integrity":"sha512-EYxO53BsBg6UZ9RX+15TtQm14NC6R8yyJWbyAmCR+xbGhnqiIzCkdjPQXi9VYOGjg9em+FW5rKqbBd0q2nKJjw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDERAOpOk0F70Wap/2W02665Iz1RGRuQjDxZvQDu9CTBgIgVIEPf7Q979RNvD1YIg17kkU0fusVHsMEDvbUcQt5nws="}]}},"0.3.1":{"name":"evidence","version":"0.3.1","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js && browserify test.js | jsdom-eval"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"keywords":["history","undo","redo"],"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"browserify":"^8.1.3","jsdom-eval":"^0.2.5","tape":"^3.5.0"},"gitHead":"b02ae54d69a51db55cac39235b48f05dd91de4b9","_id":"evidence@0.3.1","_shasum":"809ff0b89f8d157129bb7c68a7b55cac55685fe6","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"809ff0b89f8d157129bb7c68a7b55cac55685fe6","tarball":"https://registry.npmjs.org/evidence/-/evidence-0.3.1.tgz","integrity":"sha512-E74zXkwZrUAMjd1DfGjA/12qjIBdLkcRaFojKe3tSKBMwErIty3Sat10Je0vgngb8dM06y3cpT9Bha+WU67V5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC24cERE/zsEwavt8TesABghiug+ck2jB57o6J6lEGuTAiEArp1ukj909V6fDWtUTXtr0ZTJh55o52fQg06sCxegOOU="}]}},"1.0.0":{"name":"evidence","version":"1.0.0","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js && browserify test.js | jsdom-eval"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"keywords":["history","undo","redo"],"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"browserify":"^8.1.3","jsdom-eval":"^0.2.5","tape":"^3.5.0"},"gitHead":"5862e78c6e97541e98280f00e5ec03172b17b75b","_id":"evidence@1.0.0","_shasum":"df617ec1a5316c5a4ee2079a109b5c54a38bb628","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"df617ec1a5316c5a4ee2079a109b5c54a38bb628","tarball":"https://registry.npmjs.org/evidence/-/evidence-1.0.0.tgz","integrity":"sha512-9/n266eBRmi7YSkH84OAamTqEEmGHPNdCYvJDbGMkscUf4DqtbJaHVPyBSCTtJWIjuit96FNOD1xxqIjtSkOhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnlbWx6GNFaG1uzFidSusvZV5z3doQcErOEBgXql3vXwIhAMoh9leQBBR/t5DeyUjGRGg3DPNoQTx9VpQ2x/m7Zjhq"}]}},"1.0.1":{"name":"evidence","version":"1.0.1","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js && browserify test.js | jsdom-eval"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"keywords":["history","undo","redo"],"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"browserify":"^8.1.3","jsdom-eval":"^0.2.5","tape":"^3.5.0"},"gitHead":"01152731ee33be7b2de5cc0189010d709153cd43","_id":"evidence@1.0.1","_shasum":"3760d72228c735015f14a8ca197fcb2471720558","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"3760d72228c735015f14a8ca197fcb2471720558","tarball":"https://registry.npmjs.org/evidence/-/evidence-1.0.1.tgz","integrity":"sha512-hjqVShQkz6qBq2db0x6ywA5RAOwXtPDVfbIqVoHD4GvPGs2TDaJo5kf9nPpR/gfTA5SGdPVI171mOtoE0eKAAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDF2vLuC/ZfS1Tf+rc7a9FBUinC+3cpJR+BuxwGsTPH0AIgJ42ep/6Ts+QoXxgq8yjHhWP4vKxjCAXaQ9gM8g68Xfk="}]}},"1.0.2":{"name":"evidence","version":"1.0.2","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js && browserify test.js | jsdom-eval"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"keywords":["history","undo","redo"],"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"browserify":"^8.1.3","jsdom-eval":"^0.2.5","tape":"^3.5.0"},"gitHead":"ba5d88abc9165f8d772da67f552d73aa2a687083","_id":"evidence@1.0.2","_shasum":"509b91e5824ec76344bf65a4c68115e8a1c51e59","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"509b91e5824ec76344bf65a4c68115e8a1c51e59","tarball":"https://registry.npmjs.org/evidence/-/evidence-1.0.2.tgz","integrity":"sha512-1TRllz2Gf1/5VGru8Sbf1eiIQtbzdKQCHicFHExyhvFVJl/97ty3DOcf4aWL6L1ctTmBOCY2hZE12wFHGpWygA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICsRalfY+ibOvO5x/LVF1v9PAGtZjbPX8xtJ1XsuoSfaAiAgvAzH2xZygm02BJ0A8j9ehKtu0/tuyF+B0nPR9OdBwA=="}]}},"1.0.3":{"name":"evidence","version":"1.0.3","description":"Track the history of an object.","main":"index.js","scripts":{"test":"tape test.js | faucet && browserify test.js | ghostface | faucet"},"repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"keywords":["history","undo","redo"],"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"license":"MIT","bugs":{"url":"https://github.com/fardog/evidence/issues"},"homepage":"https://github.com/fardog/evidence","dependencies":{"deep-equal":"^1.0.0","duplexer":"^0.1.1","through":"^2.3.6"},"devDependencies":{"browserify":"^8.1.3","faucet":"0.0.1","ghostface":"^1.1.2","jsdom-eval":"^0.2.5","tape":"^3.5.0"},"gitHead":"2ad09ff748618ae458360b21c52dbb86f3b6b3d8","_id":"evidence@1.0.3","_shasum":"419fa3ecee52f2982d08dd6d77a97c610f3bafcf","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"fardog","email":"code@fardogllc.com"},"maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"dist":{"shasum":"419fa3ecee52f2982d08dd6d77a97c610f3bafcf","tarball":"https://registry.npmjs.org/evidence/-/evidence-1.0.3.tgz","integrity":"sha512-QChL+uDbEBTw+7XxYvniAMla2nNDWr1iA32K7qIhWmr4GgCW3UBKpiJFJ0ckCZDJgEmg93YFzyoB8DAexIKfTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG7Y8DdbXyy1+BX/MH4/hhT/8DY9WYBUqAY3/eqyAPfnAiEA8Y7X0gozWj2ydzEVso7OjO3HNQhWyDM/aGuTJpIe0Qg="}]}}},"readme":"# evidence\n\nTrack the history of an object.\n\n[![Build Status](http://img.shields.io/travis/fardog/evidence/master.svg?style=flat)](https://travis-ci.org/fardog/evidence)\n[![npm install](http://img.shields.io/npm/dm/evidence.svg?style=flat)](https://www.npmjs.org/package/evidence)\n\nA stream that takes any objects written to it, and saves them into a history\nstack. Works in node, or with [browserify][browserify].\n\n## Example\n\nAt its simplest, you simply write a value to the history, and it's saved as the\nlatest state. Any previous values pushed further down the stack.\n\n```javascript\nvar evidence = require('evidence')\n\nvar instance = evidence()\n\ninstance.write({item: 'One'})\ninstance.get(0) // {item: 'One'}\ninstance.write({item: 'Two'})\ninstance.get(0) // {item: 'Two'}\ninstance.length // 2\n```\n\nBut being a stream, you can pipe data directly to it:\n\n```javascript\nvar evidence = require('evidence')\n  , stream = require('through')()\n\nvar instance = evidence()\n\nstream.pipe(instance)\nstream.write({item: 'One'})\n\ninstance.get(0) // {item: 'One'}\n```\n\nHistory is only saved if the last value written isn't the same as the item in\nthe top of the stack. You can undo/redo by changing the head of the stack:\n\n```javascript\nvar evidence = require('evidence')\n\nvar instance = evidence()\n\ninstance.write({item: 'One'})\ninstance.write({item: 'Two'})\ninstance.write({item: 'Three'})\n\ninstance.offset++\ninstance.get(0) // {item: 'Two'}\n\ninstance.offset--\ninstance.get(0) // {item: 'Three'}\n```\n\n## API\n\n- `evidence([size])` -> Duplex Stream: Instantiates a new instance, and returns\n  a duplex stream that saves objects written to it into its internal state, and\n  emits that state so long as it's changed.\n    - `size` (Number): The number of objects that should be saved before older\n      objects are discarded. Defaults to `100`.\n\n### Methods and Properties\n\n- `instance.write([data])` - Write a new object to the stack. Any item written\n  is deep-copied before insertion into the stack.\n- `instance.get([index])` - Get the item saved at `index`, and get the last\n  item written if `index` isn't provided. New items written are saved to the\n  front of the stack, so index `0` is the latest, `1` is the item that was\n  written prior to `0`, and so on.\n\nThe following properties use [getters][getters] and [setters][setters], so\nthey won't be available in Internet Explorer 8:\n\n- `instance.offset` - Sets the new head element, or gets the current head. Any\n  further `get` calls will act as though the element you set is `0`; then `1`\n  will be the item saved prior to the new `0`, and so on.\n- `instance.length` - Get current length of the stack.\n\nIf you do need support for IE8, use these; they'll work in all browsers, and\nare what the properties above use to do their work:\n\n- `instance.getOffset()`\n- `instance.setOffset(index)`\n- `instance.getLength()`\n\n### Events\n\n- Emits a `data` event, like any stream. The value emitted is the last-written\n  object. Any time the head element changes (like if the `offset` was changed),\n  the new head element will be emitted.\n- Emits a `truncated` event when any item is truncated from the stack due to\n  the stack outgrowing the specified `size`, or due to a new state being saved\n  when an offset has been set. Emitted with the event will be an array of the\n  removed items.\n- Emits an `error` event when the offset is set greater than the stack length,\n  or less than `0`.\n\n## Notes\n\n- For performance reasons, deep copy is implemented using\n  `JSON.parse(JSON.stringify(data))`, which will fail for anything that cannot\n  be encoded to or parsed from JSON.\n- When understanding this module, think about it in terms of undo/redo. Take\n  the following example:\n    1. You write three different states to the module. The length of the stack\n       is now `3`. The last state written is at the top of the stack.\n    2. You increment the offset with `offset++`: this is like an \"undo\"; the\n       head of the stack is now at the second to last item written.\n    3. You decrement the offset with `offset--`: this is like a \"redo\"; the\n       head of the stack is now at the item it was in step 1 above.\n    4. You increment the head again with `offset++`, and then you write a new\n       value to it. You lose the item that was originally at the head, since\n       you've effectively done an \"undo\" step, and then written new history to\n       the stack. In this process, the stream emits a `truncate` event that\n       contains the item that was removed from history with your latest write.\n- Writing to a stack that has been `offset` will truncate any elements newer\n  than `offset` when written to.\n- Trying to set an offset that is less than 0 or greater than the stack length\n  will throw an error, and cause the stream to emit an 'error' event.\n\n## License\n\nMIT. See [LICENSE](./LICENSE) for details.\n\n[browserify]: http://browserify.org/\n[getters]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get\n[setters]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set\n","maintainers":[{"name":"fardog","email":"code@fardogllc.com"}],"time":{"modified":"2022-06-17T21:40:27.470Z","created":"2015-02-17T07:08:49.308Z","0.0.1":"2015-02-17T07:08:49.308Z","0.1.0":"2015-02-17T16:09:37.262Z","0.2.0":"2015-02-18T03:55:35.319Z","0.3.0":"2015-02-18T04:24:29.712Z","0.3.1":"2015-02-18T05:36:20.081Z","1.0.0":"2015-02-18T05:52:13.444Z","1.0.1":"2015-02-19T05:15:29.203Z","1.0.2":"2015-02-22T22:20:32.483Z","1.0.3":"2015-04-27T01:51:21.119Z"},"homepage":"https://github.com/fardog/evidence","repository":{"type":"git","url":"https://github.com/fardog/evidence.git"},"author":{"name":"Nathan Wittstock","email":"nate@milkandtang.com"},"bugs":{"url":"https://github.com/fardog/evidence/issues"},"license":"MIT","readmeFilename":"README.md","keywords":["history","undo","redo"],"users":{"xian":true}}