t-configurator
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -12,4 +12,7 @@ var ConfiguratorUtils_1 = require("./ConfiguratorUtils"); | ||
// ------------------------------------------------------------------------- | ||
Configurator.prototype.setConfiguration = function (configuration) { | ||
this.configuration = configuration; | ||
Configurator.prototype.addConfiguration = function (configuration) { | ||
var _this = this; | ||
Object.keys(configuration).forEach(function (c) { | ||
_this.configuration[c] = configuration[c]; | ||
}); | ||
}; | ||
@@ -19,3 +22,6 @@ Configurator.prototype.get = function (key, searchFlattened) { | ||
var config = searchFlattened ? ConfiguratorUtils_1.ConfiguratorUtils.flatten(this.configuration) : this.configuration; | ||
return Object.keys(config).reduce(function (found, configKey) { return key === configKey ? config[key] : found; }, null); | ||
var value = Object.keys(config).reduce(function (found, configKey) { return key === configKey ? config[key] : found; }, undefined); | ||
if (value && value instanceof Object) | ||
return ConfiguratorUtils_1.ConfiguratorUtils.deepClone(value); | ||
return value; | ||
}; | ||
@@ -34,3 +40,3 @@ /** | ||
Object.keys(flattenParams).forEach(function (paramKey) { | ||
var conf = '%%' + paramKey + '%%'; | ||
var conf = '%' + paramKey + '%'; | ||
if (typeof flattenConfig[key] === 'string' && flattenConfig[key].indexOf(conf) !== -1) { | ||
@@ -37,0 +43,0 @@ flattenConfig[key] = flattenConfig[key].replace(conf, flattenParams[paramKey]); |
{ | ||
"name": "t-configurator", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Allows to manage configuration files in your project", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -12,3 +12,3 @@ declare module 't-configurator/ConfiguratorUtils' { | ||
private configuration; | ||
setConfiguration(configuration: Object): void; | ||
addConfiguration(configuration: any): void; | ||
get(key: string, searchFlattened?: boolean): any; | ||
@@ -15,0 +15,0 @@ /** |
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
11498
170