diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
commit | 0a229cf5a240a1ebf4ff5d0ebb501a286bc96202 (patch) | |
tree | 2797d054788e88863d77f9826dde94fb4c276c69 /src/utility.js | |
parent | 05b6aa32a5f1633797f7eae390b3a8048b29ca69 (diff) | |
parent | ae5ef852920ce67449af7693f05a767a87aed976 (diff) |
Merge branch 'incoming'
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js index 7d122cef..b793106c 100644 --- a/src/utility.js +++ b/src/utility.js @@ -334,6 +334,17 @@ function jsonCompare(x, y) { return JSON.stringify(x) == JSON.stringify(y); } +function sortedJsonCompare(x, y) { + if (x === null || typeof x !== 'object') return x === y; + for (var i in x) { + if (!sortedJsonCompare(x[i], y[i])) return false; + } + for (var i in y) { + if (!sortedJsonCompare(x[i], y[i])) return false; + } + return true; +} + function stringifyWithFunctions(obj) { if (typeof obj === 'function') return obj.toString(); if (obj === null || typeof obj !== 'object') return JSON.stringify(obj); |