Javascript adapter to work with localStorage