cat-settings
Advanced tools
Comparing version 0.9.0 to 0.9.1
38
index.js
@@ -13,2 +13,5 @@ var jf = require('jsonfile') | ||
configurable: false, | ||
/** | ||
* Cleans all settings properties without saving | ||
*/ | ||
value: function() { | ||
@@ -31,2 +34,7 @@ for (var property in this) { | ||
configurable: false, | ||
/** | ||
* Sets all object properties to same in settings without cleaning and saving | ||
* | ||
* @param {Object} settings | ||
*/ | ||
value: function(settings) { | ||
@@ -50,2 +58,8 @@ for (var property in settings) { | ||
configurable: false, | ||
/** | ||
* Asynchronously loads object from JSON file | ||
* | ||
* @param {String} [file] | ||
* @param {Function} callback | ||
*/ | ||
value: function(file, callback) { | ||
@@ -58,6 +72,6 @@ if (file) { | ||
if (err) { | ||
return callback(err); | ||
return callback(err, null); | ||
} | ||
this._set(settings); | ||
callback(null); | ||
callback(null, this); | ||
}); | ||
@@ -75,2 +89,8 @@ } | ||
configurable: false, | ||
/** | ||
* Synchronously loads object from JSON file | ||
* | ||
* @param {String} [file] | ||
* @returns {Object} | ||
*/ | ||
value: function(file) { | ||
@@ -83,2 +103,3 @@ if (file) { | ||
this._set(settings); | ||
return this; | ||
} | ||
@@ -95,2 +116,8 @@ } | ||
configurable: false, | ||
/** | ||
* Asynchronously saves object to JSON file | ||
* | ||
* @param {String} [file] | ||
* @param {Function} callback | ||
*/ | ||
value: function(file, callback) { | ||
@@ -112,2 +139,7 @@ if (file) { | ||
configurable: false, | ||
/** | ||
* Synchronously saves object to JSON file | ||
* | ||
* @param {String} [file] | ||
*/ | ||
value: function(file) { | ||
@@ -120,2 +152,2 @@ if (file) { | ||
} | ||
); | ||
); |
{ | ||
"name": "cat-settings", | ||
"description": "Provides simple API to access and modify application settings, stored in JSON-file", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "jsonfile": "*" |
@@ -17,4 +17,3 @@ # cat-settings | ||
```javascript | ||
var settings = require('cat-settings'); | ||
settings.loadSync(__dirname + '/settings.json'); | ||
var settings = require('cat-settings').loadSync(__dirname + '/settings.json'); | ||
@@ -21,0 +20,0 @@ // You may also use async load if it makes sense |
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
11065
137
45