Implement beforeAdd callback.
Implement beforeAdd callback.

This implements a beforeAdd callback, which can be used to transform the
data loaded from localStorage/sessionStorage before assigning it to the
observable, like this:
ko.observable().extend({localStorage: {key: 'key_name_to_save_under', beforeAdd: function(data) {
    // Manipulate data here.
    return data;
}});

juodumas/ko.DOMStorageSync.js