Skip to content

jonestristand/diff-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diff-state

standard-readme compliant npm version Build Status

This is a simple module to diff two state objects that are assumed to contain the same keys. Keys whose value has changed will be returned with their new value.

Table of Contents

Install

npm install -s diff-state

Usage

const diffState = require('diff-state');

var oldState = {
  a: 'test',
  b: 23,
  c: {
    d: true,
    e: '123'
  }
}

var newState = {
  a: 'no',
  b: 23,
  c: {
    d: false,
    e: '123'
  }
}

var patch = diffState(newState, oldState);

/*
patch = {
  a: 'no',
  c: {
    d: true
  }
}
*/

Testing

npm test

Maintainers

@jonestristand

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2017 Tristan Jones

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published