New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@slimio/config

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slimio/config - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

docs/config.class.js.html

0

jsdoc.json

@@ -0,0 +0,0 @@ {

2

package.json
{
"name": "@slimio/config",
"version": "0.0.0",
"version": "0.0.1",
"description": "SlimIO Reactive JSON Config loaded",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -38,6 +38,7 @@ // Require Node.JS core packages

* @classdesc Reactive JSON Config loader class
* @template T
*
* @property {String} configFile Path to the configuration file
* @property {String} schemaFile Path to the schema configuration file
* @property {Object} payload Configuration content
* @property {T} payload Configuration content
* @property {Boolean} createOnNoEntry

@@ -50,2 +51,3 @@ * @property {Boolean} autoReload

* @property {Number} reloadDelay delay before reloading the configuration file (in millisecond).
* @property {Object} defaultSchema
*/

@@ -57,6 +59,7 @@ class Config extends Events {

* @param {!String} configFilePath Absolute path to the configuration file
* @param {Object=} [options={}] Config options
* @param {Object} [options={}] Config options
* @param {Boolean=} [options.createOnNoEntry=false] Create the configuration file when no entry are detected
* @param {Boolean=} [options.autoReload=false] Enable/Disable hot reload of the configuration file.
* @param {Boolean=} [options.writeOnSet=false] Write configuration on the disk after a set action
* @param {Object=} options.defaultSchema Optional default Schema
* @param {Number=} [options.reloadDelay=1000] Hot reload delay

@@ -93,2 +96,7 @@ *

this.subscriptionObservers = [];
// Assign defaultSchema is exist!
if (Reflect.has(options.defaultSchema)) {
this.defaultSchema = options.defaultSchema;
}
}

@@ -147,4 +155,4 @@

* @memberof Config#
* @param {Object=} defaultPayload Optional default payload (if the file doesn't exist on the disk).
* @return {Promise<void>}
* @param {T=} defaultPayload Optional default payload (if the file doesn't exist on the disk).
* @return {Promise<this>}
*/

@@ -186,3 +194,5 @@ async read(defaultPayload) {

}
JSONSchema = Config.DEFAULTSchema;
JSONSchema = is.nullOrUndefined(this.defaultSchema) ?
Config.DEFAULTSchema :
this.defaultSchema;
}

@@ -196,2 +206,4 @@

}
return this;
}

@@ -212,3 +224,2 @@

this.watcher = watcher(this.configFile, { delay: this.reloadDelay }, async(evt, name) => {
console.log("%s changed.", name);
await this.read();

@@ -221,3 +232,3 @@ this.emit("reload");

* @public
* @template T
* @template H
* @method get

@@ -227,3 +238,3 @@ * @desc Get a given field of the configuration

* @memberof Config#
* @return {T}
* @return {H}
*

@@ -265,3 +276,3 @@ * @throws {Error}

* @public
* @template T
* @template H
* @method get

@@ -271,3 +282,3 @@ * @desc Get a given field of the configuration

* @param {!String} fieldPath Path to the field (separated with dot)
* @param {!T} fieldValue Field value
* @param {!H} fieldValue Field value
* @return {Promise<void>}

@@ -274,0 +285,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