easy-configuration
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
| // Generated by CoffeeScript 1.6.2 | ||
| // Generated by CoffeeScript 1.6.3 | ||
| (function() { | ||
@@ -22,2 +22,4 @@ var EasyConfiguration, Extension, fs, path; | ||
| EasyConfiguration.prototype.data = null; | ||
| function EasyConfiguration(fileName) { | ||
@@ -42,8 +44,10 @@ this.fileName = path.resolve(fileName); | ||
| var config; | ||
| config = this.loadConfig(this.fileName); | ||
| this._parameters = config._parameters; | ||
| this.parameters = config.parameters; | ||
| config.data = this.parse(config.data); | ||
| return config.data; | ||
| if (this.data === null) { | ||
| config = this.loadConfig(this.fileName); | ||
| this._parameters = config._parameters; | ||
| this.parameters = config.parameters; | ||
| config.data = this.parse(config.data); | ||
| this.data = config.data; | ||
| } | ||
| return this.data; | ||
| }; | ||
@@ -53,3 +57,2 @@ | ||
| var data; | ||
| if (!fs.existsSync(file)) { | ||
@@ -79,3 +82,2 @@ throw new Error('Config file ' + file + ' does not exists.'); | ||
| var name, result, value; | ||
| if (parent == null) { | ||
@@ -98,3 +100,2 @@ parent = null; | ||
| var config, file, _i, _len, _ref; | ||
| _ref = data.includes; | ||
@@ -114,4 +115,10 @@ for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
| EasyConfiguration.prototype.parse = function(data) { | ||
| var name, section; | ||
| var name, section, _ref; | ||
| _ref = this.extensions; | ||
| for (name in _ref) { | ||
| section = _ref[name]; | ||
| if (typeof data[name] === 'undefined') { | ||
| data[name] = {}; | ||
| } | ||
| } | ||
| for (name in data) { | ||
@@ -131,3 +138,2 @@ section = data[name]; | ||
| var i, value, _i, _len; | ||
| switch (Object.prototype.toString.call(data)) { | ||
@@ -154,3 +160,2 @@ case '[object String]': | ||
| var _this = this; | ||
| parameter = parameter.replace(/%([a-zA-Z\.]+)%/g, function(match, param, offset, s) { | ||
@@ -167,3 +172,2 @@ if (typeof _this._parameters[param] === 'undefined') { | ||
| var i, name, type, value, _i, _len; | ||
| type = Object.prototype.toString; | ||
@@ -170,0 +174,0 @@ if (type.call(left) !== type.call(right)) { |
@@ -1,2 +0,2 @@ | ||
| // Generated by CoffeeScript 1.6.2 | ||
| // Generated by CoffeeScript 1.6.3 | ||
| (function() { | ||
@@ -3,0 +3,0 @@ var Extension; |
| { | ||
| "name": "easy-configuration", | ||
| "description": "Simply extensible loader for json config files", | ||
| "version": "1.0.4", | ||
| "version": "1.1.0", | ||
| "author": { | ||
@@ -6,0 +6,0 @@ "name": "David Kudera", |
Sorry, the diff of this file is not supported yet
15477
3.02%206
5.64%