{"id":23191476,"url":"https://github.com/michiel/state-recorder-js","last_synced_at":"2025-04-05T06:43:49.983Z","repository":{"id":136803201,"uuid":"50371172","full_name":"michiel/state-recorder-js","owner":"michiel","description":"A key, value state object that can emit or consume changes in JSON-PATCH format","archived":false,"fork":false,"pushed_at":"2016-02-02T12:50:13.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T14:33:49.290Z","etag":null,"topics":["json-diff","json-patch"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michiel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-25T18:23:39.000Z","updated_at":"2016-02-02T12:01:36.000Z","dependencies_parsed_at":"2023-04-24T22:04:45.796Z","dependency_job_id":null,"html_url":"https://github.com/michiel/state-recorder-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiel%2Fstate-recorder-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiel%2Fstate-recorder-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiel%2Fstate-recorder-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiel%2Fstate-recorder-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michiel","download_url":"https://codeload.github.com/michiel/state-recorder-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299789,"owners_count":20916186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-diff","json-patch"],"created_at":"2024-12-18T12:17:26.933Z","updated_at":"2025-04-05T06:43:49.958Z","avatar_url":"https://github.com/michiel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# state-recorder\n\nA State object that can emit or consume changes in JSON-PATCH format\n\n[![Travis build status](http://img.shields.io/travis/michiel/state-recorder-js.svg?style=flat)](https://travis-ci.org/michiel/state-recorder-js)\n[![Code Climate](https://codeclimate.com/github/michiel/state-recorder-js/badges/gpa.svg)](https://codeclimate.com/github/michiel/state-recorder-js)\n[![Test Coverage](https://codeclimate.com/github/michiel/state-recorder-js/badges/coverage.svg)](https://codeclimate.com/github/michiel/state-recorder-js)\n[![Dependency Status](https://david-dm.org/michiel/state-recorder-js.svg)](https://david-dm.org/michiel/state-recorder-js)\n[![devDependency Status](https://david-dm.org/michiel/state-recorder-js/dev-status.svg)](https://david-dm.org/michiel/state-recorder-js#info=devDependencies)\n\n\n## Example\n\n    $ npm run build\n    $ node\n\n    \u003e SR = require('./dist/state-recorder').default\n    [Function: StateRecorder]\n    \u003e var state = new SR()\n    undefined\n    \u003e state.set('keyA', 'a')\n    undefined\n    \u003e state.set('keyA', 'A')\n    undefined\n    \u003e var patches = state.getReversePatches()\n    undefined\n    \u003e patches\n    [ { op: 'remove', path: 'keyA' },\n      { op: 'replace', path: 'keyA', value: 'a' } ]\n    \u003e state.get('keyA')\n    'A'\n    \u003e state.applyPatch(patches[1])\n    undefined\n    \u003e state.get('keyA')\n    'a'\n    \u003e state.applyPatch(patches[0])\n    undefined\n    \u003e state.has('keyA')\n    false\n    \u003e state.getPatches()\n    [ [ { op: 'remove', path: 'keyA' },\n        { op: 'add', path: 'keyA', value: 'a' } ],\n      [ { op: 'replace', path: 'keyA', value: 'a' },\n        { op: 'replace', path: 'keyA', value: 'A' } ],\n      [ { op: 'replace', path: 'keyA', value: 'A' },\n        { op: 'replace', path: 'keyA', value: 'a' } ],\n      [ { op: 'add', path: 'keyA', value: 'a' },\n        { op: 'remove', path: 'keyA' } ] ]\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichiel%2Fstate-recorder-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichiel%2Fstate-recorder-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichiel%2Fstate-recorder-js/lists"}