aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/migrator
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-04-28 05:50:19 +0800
committerDan Finlay <dan@danfinlay.com>2017-04-28 05:50:19 +0800
commitd1a10691802fc7eef65f13126c684b6cdf13d461 (patch)
tree9143b42107d8aeb75fa58f8de45c5730bb8621dd /app/scripts/lib/migrator
parentb0919ba7296553200161913ab413f214aa58e741 (diff)
parenta90b010de891f7936bc17c09c5fd27c61fc0610d (diff)
downloadtangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar.gz
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar.bz2
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar.lz
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar.xz
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.tar.zst
tangerine-wallet-browser-d1a10691802fc7eef65f13126c684b6cdf13d461.zip
Merge branch 'master' into rinkeby
Diffstat (limited to 'app/scripts/lib/migrator')
-rw-r--r--app/scripts/lib/migrator/index.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/scripts/lib/migrator/index.js b/app/scripts/lib/migrator/index.js
index 312345263..c40c347b5 100644
--- a/app/scripts/lib/migrator/index.js
+++ b/app/scripts/lib/migrator/index.js
@@ -3,17 +3,17 @@ const asyncQ = require('async-q')
class Migrator {
constructor (opts = {}) {
- let migrations = opts.migrations || []
+ const migrations = opts.migrations || []
this.migrations = migrations.sort((a, b) => a.version - b.version)
- let lastMigration = this.migrations.slice(-1)[0]
+ const lastMigration = this.migrations.slice(-1)[0]
// use specified defaultVersion or highest migration version
this.defaultVersion = opts.defaultVersion || (lastMigration && lastMigration.version) || 0
}
// run all pending migrations on meta in place
migrateData (versionedData = this.generateInitialState()) {
- let remaining = this.migrations.filter(migrationIsPending)
-
+ const remaining = this.migrations.filter(migrationIsPending)
+
return (
asyncQ.eachSeries(remaining, (migration) => this.runMigration(versionedData, migration))
.then(() => versionedData)
@@ -21,12 +21,12 @@ class Migrator {
// migration is "pending" if hit has a higher
// version number than currentVersion
- function migrationIsPending(migration) {
+ function migrationIsPending (migration) {
return migration.version > versionedData.meta.version
}
}
- runMigration(versionedData, migration) {
+ runMigration (versionedData, migration) {
return (
migration.migrate(versionedData)
.then((versionedData) => {