https://github.com/bcherny/auditable
Auditable data structures for modern browsers
https://github.com/bcherny/auditable
Last synced: 2 months ago
JSON representation
Auditable data structures for modern browsers
- Host: GitHub
- URL: https://github.com/bcherny/auditable
- Owner: bcherny
- Created: 2015-10-19T03:16:54.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-06T02:19:33.000Z (over 9 years ago)
- Last Synced: 2025-06-05T00:14:39.754Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auditable [![Build Status][build]](https://circleci.com/gh/bcherny/auditable) [![npm]](https://www.npmjs.com/package/auditable) [![mit]](https://opensource.org/licenses/MIT)
[build]: https://img.shields.io/circleci/project/bcherny/auditable.svg?branch=master&style=flat-square
[npm]: https://img.shields.io/npm/v/auditable.svg?style=flat-square
[mit]: https://img.shields.io/npm/l/auditable.svg?style=flat-square> Auditable data structures for modern browsers
### Installation
```sh
npm install --save auditable
```### Usage
```ts
import {List} from 'auditable'// Make a new List
const myList = List(1, 2, 3)// Modify it
a[0] = 10
a[1] = 20// Get back a list of changes
console.log(List.audit(myList))
// => [
// [10, 20, 3],
// [10, 2, 3],
// [1, 2, 3]
// ]// Get back a list of changes and causes
console.log(List.auditWithTraces(myList))
// => [
// {
// data: [10, 20, 3],
// time: "2016-07-06T01:49:22.559Z",
// trace: [Test.fn (/Users/boris/auditable/test.js:7:5)", ...]
// },
// {data: [10, 2, 3], time: "...", trace: [...]},
// {data: [1, 2, 3], time: "...", trace: [...]}
// ]
```### Scripts
| | |
|---------------|------------|
| Run tests | `npm test` |
| Compile TypeScript | `npm run build` |
| Watch Typescript | `npm run watch` |
| Watch Typescript & TDD tests | `npm run tdd` |### TODO
- [x] Array
- [ ] Set
- [ ] WeakSet
- [ ] Object
- [ ] Map
- [ ] WeakMap