auditable

audit who modified a JS Array, Object, Map, Set, etc. and when

Usage no npm install needed!

<script type="module">
  import auditable from 'https://cdn.skypack.dev/auditable';
</script>

README

Auditable Build Status npm mit

Auditable data structures for modern browsers

Installation

npm install --save auditable

Usage

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

  • Array
  • Set
  • WeakSet
  • Object
  • Map
  • WeakMap