Last active
August 29, 2015 14:14
-
-
Save doublejosh/0e55782402f5e867dc9c to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Data transforms due to version updates. | |
*/ | |
function schema() { | |
// Update keys. | |
var keys = { | |
'MY-NEW-KEY': {'oldKey': 'MY-OLD-KEY', 'version': '0.2.0'} | |
}; | |
for (var newKey in keys) { | |
if (!$.jStorage.get(newKey) && ($.jStorage.get(keys[newKey].oldKey !== null))) { | |
$.jStorage.set(newKey, $.jStorage.set(keys[newKey].oldKey)); | |
$.jStorage.deleteKey(keys[newKey].oldKey); | |
if (typeof console != "undefined") console.log('Updated storage key: ' + newKey); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment