electron-settings
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [4.0.3](https://github.com/nathanbuchar/electron-settings/compare/v4.0.2...v4.0.3) (2024-04-11) | ||
### Bug Fixes | ||
* security issue with lodash ([6d15e65](https://github.com/nathanbuchar/electron-settings/commit/6d15e6502084264dc8c2d76b4c3905020216679a)) | ||
### [4.0.2](https://github.com/nathanbuchar/electron-settings/compare/v4.0.1...v4.0.2) (2020-06-27) | ||
@@ -7,0 +14,0 @@ |
@@ -55,3 +55,3 @@ /** | ||
*/ | ||
declare type KeyPath = string | Array<string | number>; | ||
type KeyPath = string | Array<string | number>; | ||
/** | ||
@@ -73,3 +73,3 @@ * `SettingsValue` types are the datatypes supported by | ||
*/ | ||
declare type SettingsValue = null | boolean | string | number | SettingsObject | SettingsValue[]; | ||
type SettingsValue = null | boolean | string | number | SettingsObject | SettingsValue[]; | ||
/** | ||
@@ -79,3 +79,3 @@ * A `SettingsObject` is an object whose property values | ||
*/ | ||
declare type SettingsObject = { | ||
type SettingsObject = { | ||
[key: string]: SettingsValue; | ||
@@ -88,3 +88,3 @@ }; | ||
*/ | ||
declare type Config = { | ||
type Config = { | ||
/** | ||
@@ -91,0 +91,0 @@ * Whether or not to save the settings file atomically. |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -58,6 +58,3 @@ if (y = 0, t) op = [op[0] & 2, t.value]; | ||
var write_file_atomic_1 = __importDefault(require("write-file-atomic")); | ||
var lodash_get_1 = __importDefault(require("lodash.get")); | ||
var lodash_has_1 = __importDefault(require("lodash.has")); | ||
var lodash_set_1 = __importDefault(require("lodash.set")); | ||
var lodash_unset_1 = __importDefault(require("lodash.unset")); | ||
var lodash_1 = require("lodash"); | ||
/** @internal */ | ||
@@ -157,4 +154,5 @@ var defaultConfig = { | ||
catch (err) { | ||
if (err) { | ||
if (err.code === 'ENOENT') { | ||
var e = err; | ||
if (e) { | ||
if (e.code === 'ENOENT') { | ||
saveSettingsSync({}); | ||
@@ -181,3 +179,3 @@ } | ||
if (err.code === 'ENOENT') { | ||
mkdirp_1.default(dirPath).then(function () { return resolve(); }, reject); | ||
(0, mkdirp_1.default)(dirPath).then(function () { return resolve(); }, reject); | ||
} | ||
@@ -206,4 +204,7 @@ else { | ||
catch (err) { | ||
if (err.code === 'ENOENT') { | ||
mkdirp_1.default.sync(dirPath); | ||
var e = err; | ||
if (e) { | ||
if (e.code === 'ENOENT') { | ||
mkdirp_1.default.sync(dirPath); | ||
} | ||
} | ||
@@ -269,3 +270,3 @@ else { | ||
if (config.atomicSave) { | ||
write_file_atomic_1.default(filePath, data, function (err) { | ||
(0, write_file_atomic_1.default)(filePath, data, function (err) { | ||
return err | ||
@@ -420,3 +421,3 @@ ? reject(err) | ||
obj = _a.sent(); | ||
return [2 /*return*/, lodash_has_1.default(obj, keyPath)]; | ||
return [2 /*return*/, (0, lodash_1.has)(obj, keyPath)]; | ||
} | ||
@@ -469,3 +470,3 @@ }); | ||
var obj = loadSettingsSync(); | ||
return lodash_has_1.default(obj, keyPath); | ||
return (0, lodash_1.has)(obj, keyPath); | ||
} | ||
@@ -481,3 +482,3 @@ function get(keyPath) { | ||
if (keyPath) { | ||
return [2 /*return*/, lodash_get_1.default(obj, keyPath)]; | ||
return [2 /*return*/, (0, lodash_1.get)(obj, keyPath)]; | ||
} | ||
@@ -495,3 +496,3 @@ else { | ||
if (keyPath) { | ||
return lodash_get_1.default(obj, keyPath); | ||
return (0, lodash_1.get)(obj, keyPath); | ||
} | ||
@@ -520,3 +521,3 @@ else { | ||
obj = _a.sent(); | ||
lodash_set_1.default(obj, keyPath, value); | ||
(0, lodash_1.set)(obj, keyPath, value); | ||
return [2 /*return*/, saveSettings(obj)]; | ||
@@ -539,3 +540,3 @@ } | ||
var obj = loadSettingsSync(); | ||
lodash_set_1.default(obj, keyPath, value); | ||
(0, lodash_1.set)(obj, keyPath, value); | ||
saveSettingsSync(obj); | ||
@@ -554,3 +555,3 @@ } | ||
obj = _a.sent(); | ||
lodash_unset_1.default(obj, keyPath); | ||
(0, lodash_1.unset)(obj, keyPath); | ||
return [2 /*return*/, saveSettings(obj)]; | ||
@@ -567,3 +568,3 @@ case 2: | ||
var obj = loadSettingsSync(); | ||
lodash_unset_1.default(obj, keyPath); | ||
(0, lodash_1.unset)(obj, keyPath); | ||
saveSettingsSync(obj); | ||
@@ -570,0 +571,0 @@ } |
{ | ||
"name": "electron-settings", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "A simple and robust settings management library for Electron.", | ||
@@ -39,6 +39,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"lodash.get": "^4.4.2", | ||
"lodash.has": "^4.5.2", | ||
"lodash.set": "^4.3.2", | ||
"lodash.unset": "^4.5.2", | ||
"lodash": "^4.17.21", | ||
"mkdirp": "^1.0.4", | ||
@@ -48,6 +45,3 @@ "write-file-atomic": "^3.0.3" | ||
"devDependencies": { | ||
"@types/lodash.get": "^4.4.6", | ||
"@types/lodash.has": "^4.5.6", | ||
"@types/lodash.set": "^4.3.6", | ||
"@types/lodash.unset": "^4.5.6", | ||
"@types/lodash": "^4.17.0", | ||
"@types/mkdirp": "^1.0.0", | ||
@@ -70,4 +64,4 @@ "@types/mocha": "^7.0.2", | ||
"ts-node": "^8.10.1", | ||
"typedoc": "^0.17.7", | ||
"typescript": "^3.9.3" | ||
"typedoc": "^0.25.13", | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -74,0 +68,0 @@ "peerDependencies": { |
@@ -40,2 +40,12 @@ # Electron Settings | ||
⚠ For Electron v10+, if you want to use electron-settings within a browser window, be sure to set the `enableRemoteModule` web preference to `true`. Otherwise you might get the error `Cannot read property 'app' of undefined`. See [#133](https://github.com/nathanbuchar/electron-settings/issues/133) for more info. | ||
```js | ||
new BrowserWindow({ | ||
webPreferences: { | ||
enableRemoteModule: true // <-- Add me | ||
} | ||
}); | ||
``` | ||
### API Docs | ||
@@ -42,0 +52,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49637
4
20
1172
78
+ Addedlodash@^4.17.21
+ Addedlodash@4.17.21(transitive)
- Removedlodash.get@^4.4.2
- Removedlodash.has@^4.5.2
- Removedlodash.set@^4.3.2
- Removedlodash.unset@^4.5.2
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.has@4.5.2(transitive)
- Removedlodash.set@4.3.2(transitive)
- Removedlodash.unset@4.5.2(transitive)