java-properties
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -28,10 +28,5 @@ /* | ||
get: function(key) { | ||
var self = this; | ||
var rawValue = objs[key]; | ||
if (rawValue) { | ||
return rawValue | ||
.replace(/\\\\/g, '\\') | ||
.replace(/\$\{([A-Za-z0-9\.]*)\}/g, function(match) { | ||
return self.get(match.substring(2, match.length - 1)); | ||
}); | ||
return this.interpolate(rawValue); | ||
} | ||
@@ -41,4 +36,12 @@ }, | ||
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)); | ||
}); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "java-properties", | ||
"description": "Reads and interpolates Java .properties files", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "http://github.com/mattdsteele/java-properties", | ||
@@ -34,5 +34,5 @@ "author": { | ||
"grunt-contrib-watch": "~0.2.0", | ||
"grunt": "~0.4.0" | ||
"grunt": "~0.4.1" | ||
}, | ||
"keywords": ["java", "properties"] | ||
} |
@@ -88,3 +88,15 @@ 'use strict'; | ||
test.done(); | ||
}, | ||
'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) { | ||
test.expect(1); | ||
test.equal('version 7 is the best!', props.interpolate('version ${ricola.version.minor} is the best!')); | ||
test.done(); | ||
} | ||
}; |
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
8832
181