migrate-local-storage
v1.0.2
Published
A simple framework for applying version controlled migrations to localStorage data in client browsers.
Downloads
5
Readme
MigrateLocalStorage
Migrations are like version control for your data schema. MigrateLocalStorage
allows you to seamlessly apply the popular pattern of Migrations to front end projects that utilize the localStorage API.
You can think of each migration as being a new 'version' of the database. A schema starts off with nothing in it, and each migration modifies it to add, remove or modify entries. MigrateLocalStorage
knows how to update your schema along this timeline, bringing it from whatever point it is in the history to the latest version.
Install
npm install --save migrate-local-storage
Methods
migrate(migrations: Array, config: Object)
config
config.primaryKey : String
Default "ID".
config.dateAppliedKey : String
Default "dateApplied".
config.encoder : Func
Function to run when transcribing a JavaScript migration object to localStorage after processing.