Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryardley/versionable
Memory efficient version control for your javascript objects
https://github.com/ryardley/versionable
Last synced: 21 days ago
JSON representation
Memory efficient version control for your javascript objects
- Host: GitHub
- URL: https://github.com/ryardley/versionable
- Owner: ryardley
- Created: 2020-02-10T12:55:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T06:53:32.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T04:11:04.411Z (about 1 month ago)
- Language: TypeScript
- Size: 1.06 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Versionable
This is experimental and not ready for use quite yet (eta March 2020).
An event driven memory efficient version control data container.
```ts
const store = new Versionable();store.setIn(["foo", "bar"], "This is foo.bar!");
store.toJS(); // { foo: { bar: "This is foo.bar!" } }
store.log(); // []
store.commit(); // { id: '12345678', parent: null }
store.log(); // [{ id: '12345678' } ]
store.setIn(["foo", "bar"], "BAZZZ!");
store.setIn(["thing"], "pop!");
store.commit(); // { id: '23456789', parent: '12345678' }
store.log(); // [{ id: '12345678', parent: null }, { id: '23456789', parent: '12345678' }]
store.toJS(); // { foo: { bar: "BAZZZ!" }, thing: "pop!" }
store.checkout("12345678"); // { id: '12345678', parent: null }
store.current(); // { id: '12345678', parent: null }
store.toJS(); // { foo: { bar: "This is foo.bar!" } }
```## Why?
I needed a way to branch from history of user actions and for users to go back to any state in the app and build up new history branches. I also needed to serialize the data and send it to the server in the most efficient way possible.