properties-reader
Advanced tools
Comparing version 0.0.14 to 0.0.15
{ | ||
"name": "properties-reader", | ||
"description": "Properties file reader for Node.js", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Steve King", |
@@ -68,2 +68,5 @@ Properties-Reader | ||
To get the complete set of properties, either loop through them with the `.each((key, value) => {})` iterator or | ||
use the convenience method `getAllProperties` to return the complete set of flattened properties. | ||
Data Types | ||
@@ -70,0 +73,0 @@ ========== |
@@ -187,2 +187,15 @@ (function() { | ||
/** | ||
* Gets the object that represents all properties. | ||
* | ||
* @returns {Object} | ||
*/ | ||
PropertiesReader.prototype.getAllProperties = function() { | ||
var properties = {}; | ||
this.each(function (key, value) { | ||
properties[key] = value; | ||
}); | ||
return properties; | ||
}; | ||
/** | ||
* Creates and returns a new PropertiesReader based on the values in this instance. | ||
@@ -189,0 +202,0 @@ * @return {PropertiesReader} |
@@ -212,3 +212,36 @@ | ||
), "fetch an entire object"); | ||
}, | ||
'test getAllProperties returns properties map': function () { | ||
givenFilePropertiesReader('\ | ||
root.a.b = Hello\n\ | ||
some.thing = Else\n\ | ||
'); | ||
Assertions.assert(same( | ||
properties.getAllProperties(), | ||
{ | ||
'root.a.b': "Hello", | ||
'some.thing': 'Else' | ||
} | ||
), "fetch an entire object"); | ||
}, | ||
'test getAllProperties is immutable': function () { | ||
givenFilePropertiesReader('\ | ||
root.a.b = Hello\n\ | ||
some.thing = Else\n\ | ||
'); | ||
var allProperties = properties.getAllProperties(); | ||
allProperties['root.a.b'] = 'New Value'; | ||
Assertions.assert(same( | ||
properties.getAllProperties(), | ||
{ | ||
'root.a.b': "Hello", | ||
'some.thing': 'Else' | ||
} | ||
), "properties remain unchanged"); | ||
} | ||
}); |
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
28060
566
82