How to handle arrays?
bloodchen opened this issue · 4 comments
bloodchen commented
Let's say I have a config
{
"items":[ {"name":"abc"},{"name":"dadd"}]
}
How can I add an item to items array?
Thanks
sindresorhus commented
There's currently no nice way to do this. You'll have to do something like:
store.set('items', [...store.get('items'), newItem]);
I plan to add a convenience method for this. See: sindresorhus/electron-store#52
Nisthar commented
@sindresorhus Doesn't this cause performance issues when the array is big?
sindresorhus commented
Only for huge arrays, and you should not store huge chunks of data in conf
anyway.
sindresorhus commented
For anyone wanting to work on this, see the initial attempt and feedback in: #124