Socket
Socket
Sign inDemoInstall

electron-store

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-store - npm Package Compare versions

Comparing version 8.0.2 to 8.1.0

6

package.json
{
"name": "electron-store",
"version": "8.0.2",
"version": "8.1.0",
"description": "Simple data persistence for your Electron app or module - Save and load user preferences, app state, cache, etc",

@@ -37,4 +37,4 @@ "license": "MIT",

"dependencies": {
"conf": "^10.1.2",
"type-fest": "^2.12.2"
"conf": "^10.2.0",
"type-fest": "^2.17.0"
},

@@ -41,0 +41,0 @@ "devDependencies": {

@@ -161,2 +161,48 @@ # electron-store

### beforeEachMigration
Type: `Function`\
Default: `undefined`
The given callback function will be called before each migration step.
The function receives the store as the first argument and a context object as the second argument with the following properties:
- `fromVersion` - The version the migration step is being migrated from.
- `toVersion` - The version the migration step is being migrated to.
- `finalVersion` - The final version after all the migrations are applied.
- `versions` - All the versions with a migration step.
This can be useful for logging purposes, preparing migration data, etc.
Example:
```js
const Store = require('electron-store');
console.log = someLogger.log;
const mainConfig = new Store({
beforeEachMigration: (store, context) => {
console.log(`[main-config] migrate from ${context.fromVersion} → ${context.toVersion}`);
},
migrations: {
'0.4.0': store => {
store.set('debugPhase', true);
}
}
});
const secondConfig = new Store({
beforeEachMigration: (store, context) => {
console.log(`[second-config] migrate from ${context.fromVersion} → ${context.toVersion}`);
},
migrations: {
'1.0.1': store => {
store.set('debugPhase', true);
}
}
});
```
#### name

@@ -163,0 +209,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc