java-properties
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -26,21 +26,24 @@ /* | ||
return { | ||
get: function(key) { | ||
var rawValue = objs[key]; | ||
if (rawValue) { | ||
return this.interpolate(rawValue); | ||
} | ||
}, | ||
set: function(key, value) { | ||
objs[key] = value; | ||
}, | ||
interpolate: function(s) { | ||
var self = this; | ||
return s | ||
.replace(/\\\\/g, '\\') | ||
.replace(/\$\{([A-Za-z0-9\.]*)\}/g, function(match) { | ||
return self.get(match.substring(2, match.length - 1)); | ||
}); | ||
var get = function(key) { | ||
var rawValue = objs[key]; | ||
if (rawValue) { | ||
return interpolate(rawValue); | ||
} | ||
}; | ||
var set = function(key, value) { | ||
objs[key] = value; | ||
}; | ||
var interpolate = function(s) { | ||
return s | ||
.replace(/\\\\/g, '\\') | ||
.replace(/\$\{([A-Za-z0-9\.]*)\}/g, function(match) { | ||
return get(match.substring(2, match.length - 1)); | ||
}); | ||
}; | ||
return { | ||
get: get, | ||
set: set, | ||
interpolate: interpolate | ||
}; | ||
}; |
{ | ||
"name": "java-properties", | ||
"description": "Reads and interpolates Java .properties files", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "http://github.com/mattdsteele/java-properties", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -89,9 +89,2 @@ 'use strict'; | ||
}, | ||
'problematic file': function(test) { | ||
test.expect(2); | ||
props = properties.of('test/fixtures/service.properties'); | ||
test.equal('service', props.get('service.dir')); | ||
test.equal('service/secure', props.get('service.secured.dir')); | ||
test.done(); | ||
}, | ||
'interpolating' : function(test) { | ||
@@ -98,0 +91,0 @@ test.expect(1); |
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
8558
176