Socket
Socket
Sign inDemoInstall

@hapiness/config

Package Overview
Dependencies
80
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-rc.6.1 to 1.0.0

22

index.js

@@ -1,17 +0,7 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./lib"], factory);
}
})(function (require, exports) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./lib"));
});
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./lib"));
//# sourceMappingURL=index.js.map

@@ -1,69 +0,59 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const c = require("config");
const clone = require("clone");
class Config {
/**
* Load the config
*/
static load(payload) {
if (payload) {
// This method will make the payload object have
// .get (chainable) .has and .util method
// Allowing custom object to be feed in the config module
const _payload = clone(payload);
this._data = this.attachProtoDeep(_payload);
return _payload;
}
this._data = c;
return this._data;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "config", "clone"], factory);
static attachProtoDeep(payload) {
return this._data.util['attachProtoDeep'](payload);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const c = require("config");
const clone = require("clone");
class Config {
/**
* Load the config
*/
static load(payload) {
if (payload) {
// This method will make the payload object have
// .get (chainable) .has and .util method
// Allowing custom object to be feed in the config module
const _payload = clone(payload);
this._data = this.attachProtoDeep(_payload);
return _payload;
}
this._data = c;
return this._data;
/**
* Return config data
*/
static getData() {
return this._data;
}
/**
* Check if the settings exists
*
* @param {string} key
* @returns boolean
*/
static has(key) {
return this._data.has(key);
}
/**
* Return the config value
* from a key
*
* @param {string} key
* @param {any} defaultValue
* @returns any
*/
static get(key, defaultValue) {
if (!this._data) {
this.load();
}
static attachProtoDeep(payload) {
return this._data.util['attachProtoDeep'](payload);
if (!this._data) {
throw new Error('Empty config data');
}
/**
* Return config data
*/
static getData() {
return this._data;
}
/**
* Check if the settings exists
*
* @param {string} key
* @returns boolean
*/
static has(key) {
return this._data.has(key);
}
/**
* Return the config value
* from a key
*
* @param {string} key
* @param {any} defaultValue
* @returns any
*/
static get(key, defaultValue) {
if (!this._data) {
this.load();
}
if (!this._data) {
throw new Error('Empty config data');
}
return this._data.has(key) ? this._data.get(key) :
!!defaultValue ? defaultValue : undefined;
}
return this._data.has(key) ? this._data.get(key) :
!!defaultValue ? defaultValue : undefined;
}
exports.Config = Config;
});
}
exports.Config = Config;
//# sourceMappingURL=config.js.map

@@ -1,55 +0,45 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@hapiness/core");
const config_1 = require("./config");
const ConfigInjectionTokens = {};
const ConfigFileInjectionToken = new core_1.InjectionToken('HAPINESS_CONFIG');
class ConfigHelper {
static getInjectionToken(key) {
if (!key) {
return ConfigFileInjectionToken;
}
if (!ConfigInjectionTokens[key]) {
ConfigInjectionTokens[key] = new core_1.InjectionToken(`HAPINESS_CONFIG_${key}`);
}
return ConfigInjectionTokens[key];
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@hapiness/core", "./config"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@hapiness/core");
const config_1 = require("./config");
const ConfigInjectionTokens = {};
const ConfigFileInjectionToken = new core_1.InjectionToken('HAPINESS_CONFIG');
class ConfigHelper {
static getInjectionToken(key) {
if (!key) {
return ConfigFileInjectionToken;
static getProvider(key, value) {
const provide = ConfigHelper.getInjectionToken(key);
if (key) {
// key and value provided, we load the value
if ((typeof value === 'object' && value !== null)) {
return {
provide,
useValue: config_1.Config.attachProtoDeep(value)
};
}
if (!ConfigInjectionTokens[key]) {
ConfigInjectionTokens[key] = new core_1.InjectionToken(`HAPINESS_CONFIG_${key}`);
else
// If we dont have any value but a key we check if
// the key exists in config and use it as value
if (config_1.Config.has(key)) {
return {
provide,
useValue: config_1.Config.get(key)
};
}
return ConfigInjectionTokens[key];
}
static getProvider(key, value) {
const provide = ConfigHelper.getInjectionToken(key);
if (key) {
// key and value provided, we load the value
if ((typeof value === 'object' && value !== null)) {
return {
provide,
useValue: config_1.Config.attachProtoDeep(value)
};
}
else
// If we dont have any value but a key we check if
// the key exists in config and use it as value
if (config_1.Config.has(key)) {
return {
provide,
useValue: config_1.Config.get(key)
};
}
}
// Otherwise just return the default config object
return {
provide,
useValue: config_1.Config.load()
};
}
// Otherwise just return the default config object
return {
provide,
useValue: config_1.Config.load()
};
}
exports.ConfigHelper = ConfigHelper;
});
}
exports.ConfigHelper = ConfigHelper;
//# sourceMappingURL=helper.js.map

@@ -1,18 +0,8 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./config", "./helper"], factory);
}
})(function (require, exports) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./config"));
__export(require("./helper"));
});
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./config"));
__export(require("./helper"));
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"name":"@hapiness/config","version":"1.0.0-rc.6.1","description":"Configuration Library to use it inside Hapiness framework","main":"index.js","types":"index.d.ts","private":false,"repository":{"type":"git","url":"git+ssh://git@github.com/hapinessjs/config.git"},"keywords":["config","yml","node-config","Hapiness","Framework","NodeJS","Node","ES2015","ES2016","ES2017","ES6","ES7","ES8","Typescript"],"contributors":[{"name":"Julien Fauville","url":"https://github.com/Juneil"},{"name":"Antoine Gomez","url":"https://github.com/antoinegomez"},{"name":"Sébastien Ritz","url":"https://github.com/reptilbud"},{"name":"Nicolas Jessel","url":"https://github.com/njl07"}],"license":"SEE LICENSE IN https://github.com/hapinessjs/config/blob/master/LICENSE.md","bugs":{"url":"https://github.com/hapinessjs/config/issues"},"homepage":"https://github.com/hapinessjs/config#readme","dependencies":{"@types/config":"^0.0.32","@types/node":"^8.0.17","clone":"^2.1.1","config":"^1.26.1","debug":"^2.6.8","js-yaml":"^3.8.4"},"engines":{"node":">=7.0.0"},"peerDependencies":{"@hapiness/core":"^1.0.0-rc.6","rxjs":"^5.4.2"}}
{"name":"@hapiness/config","version":"1.0.0","description":"Configuration Library to use it inside Hapiness framework","main":"index.js","types":"index.d.ts","private":false,"repository":{"type":"git","url":"git+ssh://git@github.com/hapinessjs/config.git"},"keywords":["config","yml","node-config","Hapiness","Framework","NodeJS","Node","ES2015","ES2016","ES2017","ES6","ES7","ES8","Typescript"],"contributors":[{"name":"Julien Fauville","url":"https://github.com/Juneil"},{"name":"Antoine Gomez","url":"https://github.com/antoinegomez"},{"name":"Sébastien Ritz","url":"https://github.com/reptilbud"},{"name":"Nicolas Jessel","url":"https://github.com/njl07"}],"license":"SEE LICENSE IN https://github.com/hapinessjs/config/blob/master/LICENSE.md","bugs":{"url":"https://github.com/hapinessjs/config/issues"},"homepage":"https://github.com/hapinessjs/config#readme","dependencies":{"@types/config":"^0.0.33","@types/node":"^8.0.47","clone":"^2.1.1","config":"^1.27.0","debug":"^3.1.0","js-yaml":"^3.10.0"},"engines":{"node":">=7.0.0"},"peerDependencies":{"@hapiness/core":"^1.1.1","rxjs":"^5.5.2"}}

@@ -53,7 +53,7 @@ <img src="http://bit.ly/2mxmKKI" width="500" alt="Hapiness" />

```bash
$ npm install --save @hapiness/config
$ npm install --save @hapiness/core @hapiness/config rxjs
or
$ yarn add @hapiness/config
$ yarn add @hapiness/core @hapiness/config rxjs
```

@@ -63,4 +63,5 @@

"dependencies": {
"@hapiness/core": "^1.0.0-rc.6",
"@hapiness/config": "^1.0.0-rc.6",
"@hapiness/core": "^1.1.1",
"@hapiness/config": "^1.0.0",
"rxjs": "^5.5.2",
//...

@@ -205,25 +206,7 @@ }

* v1.0.0-rc.6 (2017-07-18)
* Latest packages versions.
* Config provider helper.
* Module version related to core version.
* v1.0.0-rc.4 (2017-07-11)
* Latest packages versions
* Module version related to core version.
* v1.0.0-beta.6 (2017-05-26)
* Latest packages versions
* Module version related to core version.
* v1.0.0-beta.5 (2017-05-15)
* Latest packages versions
* Module version related to core version.
* v1.0.0-beta.4 (2017-05-15)
* Latest packages versions
* Fix phony scripts
* Documentation.
* Module version related to core version.
* v1.0.0-beta.3 (2017-05-11)
* v1.0.0 (2017-10-27)
* Create `Config` module.
* Tests module.
* Documentation.
* Module version related to core version.
* First stable version.

@@ -236,3 +219,3 @@ [Back to top](#table-of-contents)

<tr>
<td colspan="4" align="center"><a href="https://www.tadaweb.com"><img src="https://tadaweb.com/images/tadaweb/logo.png" width="117" alt="tadaweb" /></a></td>
<td colspan="4" align="center"><a href="https://www.tadaweb.com"><img src="http://bit.ly/2xHQkTi" width="117" alt="tadaweb" /></a></td>
</tr>

@@ -239,0 +222,0 @@ <tr>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc