forked from cdinger/jquery-objectdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
a jQuery plugin for comparing objects
License
christian-beckmann/jquery-objectdiff
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
jquery-objectdiff - a jQuery plugin
This plugin is just a helper function for calculating a diff of two similar
objects ala ActiveRecord's changes hash. Just pass in two objects and this
function will return an object of changes that contains only the properties
that have changed. Differences are stored in arrays; the first element has
the 'before' value and the second element is the 'after' value.
Usage:
var before = {id:123, name:{first:"Johnny", last:"Johnson"}};
var after = {id:123, name:{first:"John", last:"Johnson"}, age:30};
var changes = $.objectDiff(before, after);
Result (contents of changes):
{name: {first:["Johnny","John"]}, age:[null,30]}
About
a jQuery plugin for comparing objects
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- JavaScript 93.4%
- CSS 6.6%