Skip to content

Instantly share code, notes, and snippets.

View tobychung's full-sized avatar
💭
🐕

Toby tobychung

💭
🐕
View GitHub Profile
@tobychung
tobychung / difference.js
Last active October 29, 2015 02:25
比較obj差異
function findDifferences(objectA, objectB) {
var propertyChanges = [];
var objectGraphPath = ["this"];
(function(a, b) {
if(a.constructor == Array) {
// BIG assumptions here: That both arrays are same length, that
// the members of those arrays are _essentially_ the same, and
// that those array members are in the same order...
for(var i = 0; i < a.length; i++) {
objectGraphPath.push("[" + i.toString() + "]");