Open vothvovo opened 1 year ago
Yes as explained in the README :
.reset(...keys)
Reset items to their default values, as defined by the defaults or schema option.
Use .clear() to reset all items.
No, it clears the current store, as you can see here: https://github.com/sindresorhus/conf/blob/92320d7e2c9db2c56b05dd654c3a248a635598d2/source/index.ts#L285-L291
I think the problem @vothvovo faced is that when you create 2 different stores they will overwrite each other. I assume it's because they share the same config.json file. I tried it myself on this demo project to validate it.
const Store = require('electron-store');
const store1 = new Store();
const store2 = new Store();
store1.set('unicorn', '🦄');
store2.set('unicorn', '🦄');
console.log(store1.get('unicorn'));
//=> '🦄'
console.log(store2.get('unicorn'));
//=> '🦄'
store1.clear();
console.log(store1.get('unicorn'));
//=> undefined
console.log(store2.get('unicorn'));
//=> undefined
Is this intended? I feel like it is unintuitive.