This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Deep diff between two object, using lodash | |
| * @param {Object} object Object compared | |
| * @param {Object} base Object to compare with | |
| * @return {Object} Return a new object who represent the diff | |
| */ | |
| function difference(object, base) { | |
| function changes(object, base) { | |
| return _.transform(object, function(result, value, key) { | |
| if (!_.isEqual(value, base[key])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // I mean, seriously, localStorage is supported even by your mum. How about instead of | |
| // casing the feature out, you give users in-memory (stale) storage instead? | |
| // If they close your application, they deserve to lose data anyway. | |
| // if (!('localStorage' in window)) { | |
| if (!Modernizr.localstorage) { | |
| window.localStorage = { | |
| _data : {}, | |
| setItem : function(id, val) { return this._data[id] = String(val); }, | |
| getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, |