| import optionsPrototype from './optionsPrototype.json5'; |
| import specialOptions from './specialOptions.json5'; |
| export {optionsPrototype, specialOptions}; |
| // Adds missing options with their default value. If |dryRun| is set to false, |
| // they are also saved to the sync storage area. |
| export function cleanUpOptions(options, dryRun = false) { |
| console.log('[cleanUpOptions] Previous options', JSON.stringify(options)); |
| if (typeof options !== 'object' || options === null) options = {}; |
| for (const [opt, optMeta] of Object.entries(optionsPrototype)) { |
| options[opt] = optMeta['defaultValue']; |
| console.log('[cleanUpOptions] New options', JSON.stringify(options)); |
| chrome.storage.sync.set(options); |