Skip to content

Commit

Permalink
Add license file
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 26, 2018
1 parent 35d46bb commit d213757
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: node_js
node_js:
- '8'
- '6'
- '4'
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Configstore {
this.path = path.join(configDir, pathPrefix);
this.all = Object.assign({}, defaults, this.all);
}

get all() {
try {
return JSON.parse(fs.readFileSync(this.path, 'utf8'));
Expand All @@ -48,6 +49,7 @@ class Configstore {
throw err;
}
}

set all(val) {
try {
// Make sure the folder exists as it could have been deleted in the meantime
Expand All @@ -63,12 +65,15 @@ class Configstore {
throw err;
}
}

get size() {
return Object.keys(this.all || {}).length;
}

get(key) {
return dotProp.get(this.all, key);
}

set(key, val) {
const config = this.all;

Expand All @@ -82,14 +87,17 @@ class Configstore {

this.all = config;
}

has(key) {
return dotProp.has(this.all, key);
}

delete(key) {
const config = this.all;
dotProp.delete(config, key);
this.all = config;
}

clear() {
this.all = {};
}
Expand Down
9 changes: 9 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90 changes: 45 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
{
"name": "configstore",
"version": "3.1.1",
"description": "Easily load and save config without having to think about where and how",
"license": "BSD-2-Clause",
"repository": "yeoman/configstore",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"config",
"store",
"storage",
"conf",
"configuration",
"settings",
"preferences",
"json",
"data",
"persist",
"persistent",
"save"
],
"dependencies": {
"dot-prop": "^4.1.0",
"graceful-fs": "^4.1.2",
"make-dir": "^1.0.0",
"unique-string": "^1.0.0",
"write-file-atomic": "^2.0.0",
"xdg-basedir": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "configstore",
"version": "3.1.1",
"description": "Easily load and save config without having to think about where and how",
"license": "BSD-2-Clause",
"repository": "yeoman/configstore",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"config",
"store",
"storage",
"conf",
"configuration",
"settings",
"preferences",
"json",
"data",
"persist",
"persistent",
"save"
],
"dependencies": {
"dot-prop": "^4.1.0",
"graceful-fs": "^4.1.2",
"make-dir": "^1.0.0",
"unique-string": "^1.0.0",
"write-file-atomic": "^2.0.0",
"xdg-basedir": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

0 comments on commit d213757

Please sign in to comment.