代码拉取完成,页面将自动刷新
const DefaultSettings = {
"logC": false,
"logS": false,
"logF": "Only",
"logJ": false,
"logR": false,
"logP": "String"
}
module.exports = function MigrateSettings(from_ver, to_ver, settings) {
if (from_ver === undefined) {
// Migrate legacy config file
return Object.assign(Object.assign({}, DefaultSettings), settings)
} else if (from_ver === null) {
// No config file exists, use default settings
return DefaultSettings
} else {
// Migrate from older version (using the new system) to latest one
if (from_ver + 1 < to_ver) { // Recursively upgrade in one-version steps
settings = MigrateSettings(from_ver, from_ver + 1, settings)
return MigrateSettings(from_ver + 1, to_ver, settings)
}
// If we reach this point it's guaranteed that from_ver === to_ver - 1, so we can implement
// a switch for each version step that upgrades to the next version. This enables us to
// upgrade from any version to the latest version without additional effort!
switch (to_ver) {
default:
let oldsettings = settings
settings = Object.assign(DefaultSettings, {})
for (let option in oldsettings) {
if (settings[option]) {
settings[option] = oldsettings[option]
}
}
break
}
return settings
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。