diff --git a/index.js b/index.js index 8a030f0..561dbdd 100644 --- a/index.js +++ b/index.js @@ -22,7 +22,10 @@ class Configstore { this.path = options.configPath || path.join(configDirectory, pathPrefix); if (defaults) { - this.all = Object.assign({}, defaults, this.all); + this.all = { + ...defaults, + ...this.all + }; } } @@ -55,7 +58,7 @@ class Configstore { // Make sure the folder exists as it could have been deleted in the meantime makeDir.sync(path.dirname(this.path), makeDirOptions); - writeFileAtomic.sync(this.path, JSON.stringify(value, null, '\t'), writeFileOptions); + writeFileAtomic.sync(this.path, JSON.stringify(value, undefined, '\t'), writeFileOptions); } catch (error) { // Improve the message of permission errors if (error.code === 'EACCES') { diff --git a/package.json b/package.json index 8dc4154..89dfbd9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { "test": "xo && ava" @@ -32,15 +32,15 @@ "save" ], "dependencies": { - "dot-prop": "^4.1.0", + "dot-prop": "^5.1.0", "graceful-fs": "^4.1.2", - "make-dir": "^2.1.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" }, "devDependencies": { - "ava": "^1.3.1", + "ava": "^2.1.0", "xo": "^0.24.0" } } diff --git a/readme.md b/readme.md index e4ebf16..6d8e2d0 100644 --- a/readme.md +++ b/readme.md @@ -63,6 +63,8 @@ Default config. #### options +Type: `object` + ##### globalConfigPath Type: `boolean`