Skip to content
Compares JavaScript objects
JavaScript CSS
Find file
Pull request Compare This branch is 1 commit ahead of NV:gh-pages.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
spec
MIT-LICENSE.txt
README.mdown
bower.json
index.html
jasmine-objectDiff.js
objectDiff.css
objectDiff.js
package.json
style.css

README.mdown

objectDiff

objectDiff.diff(objectA, objectB)

objectDiff.diff({x: 1}, {x: 2})
-> {
  changed: "object change",
  value: {
    x: {
      changed: "primitive change",
      removed: 1,
      added: 2
    }
  }
}

objectDiff.diff({z: {x: 1}}, {z: {y: 2}})
-> {
  changed: "object change",
  value: {
    z: {
      changed: "object change",
      value: {
        x: {
          changed: "removed",
          value: 1
        },
        y: {
          changed: "added",
          value: 2
        }
      }
    }
  }
}

Jasmine integration

objectDiff provides toEqualProperties matchers for Jasmine. See example spec.

Something went wrong with that request. Please try again.