You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.7 KiB
1 line
5.7 KiB
2 years ago
|
{"ast":null,"code":"import { DEFAULT_VERSION } from './constants';\nexport default function createMigrate(migrations, config) {\n var _ref = config || {},\n debug = _ref.debug;\n\n return function (state, currentVersion) {\n if (!state) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: no inbound state, skipping migration');\n return Promise.resolve(undefined);\n }\n\n var inboundVersion = state._persist && state._persist.version !== undefined ? state._persist.version : DEFAULT_VERSION;\n\n if (inboundVersion === currentVersion) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: versions match, noop migration');\n return Promise.resolve(state);\n }\n\n if (inboundVersion > currentVersion) {\n if (process.env.NODE_ENV !== 'production') console.error('redux-persist: downgrading version is not supported');\n return Promise.resolve(state);\n }\n\n var migrationKeys = Object.keys(migrations).map(function (ver) {\n return parseInt(ver);\n }).filter(function (key) {\n return currentVersion >= key && key > inboundVersion;\n }).sort(function (a, b) {\n return a - b;\n });\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: migrationKeys', migrationKeys);\n\n try {\n var migratedState = migrationKeys.reduce(function (state, versionKey) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: running migration for versionKey', versionKey);\n return migrations[versionKey](state);\n }, state);\n return Promise.resolve(migratedState);\n } catch (err) {\n return Promise.reject(err);\n }\n };\n}","map":{"version":3,"names":["DEFAULT_VERSION","createMigrate","migrations","config","_ref","debug","state","currentVersion","process","env","NODE_ENV","console","log","Promise","resolve","undefined","inboundVersion","_persist","version","error","migrationKeys","Object","keys","map","ver","parseInt","filter","key","sort","a","b","migratedState","reduce","versionKey","err","reject"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/redux-persist/es/createMigrate.js"],"sourcesContent":["import { DEFAULT_VERSION } from './constants';\nexport default function createMigrate(migrations, config) {\n var _ref = config || {},\n debug = _ref.debug;\n\n return function (state, currentVersion) {\n if (!state) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: no inbound state, skipping migration');\n return Promise.resolve(undefined);\n }\n\n var inboundVersion = state._persist && state._persist.version !== undefined ? state._persist.version : DEFAULT_VERSION;\n\n if (inboundVersion === currentVersion) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: versions match, noop migration');\n return Promise.resolve(state);\n }\n\n if (inboundVersion > currentVersion) {\n if (process.env.NODE_ENV !== 'production') console.error('redux-persist: downgrading version is not supported');\n return Promise.resolve(state);\n }\n\n var migrationKeys = Object.keys(migrations).map(function (ver) {\n return parseInt(ver);\n }).filter(function (key) {\n return currentVersion >= key && key > inboundVersion;\n }).sort(function (a, b) {\n return a - b;\n });\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: migrationKeys', migrationKeys);\n\n try {\n var migratedState = migrationKeys.reduce(function (state, versionKey) {\n if (process.env.NODE_ENV !== 'production' && debug) console.log('redux-persist: running migration for versionKey', versionKey);\n return migrations[versionKey](state);\n }, state);\n return Promise.resolve(migratedState);\n } catch (err) {\n return Promise.reject(err);\n }\n };\n}"],"mappings":"AAAA,SAASA,eAAT,QAAgC,aAAhC;AACA,eAAe,SAASC,aAA
|