properties-parser
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -404,2 +404,6 @@ var fs = require("fs"); | ||
function editorFromString(text, options) { | ||
return new Editor(text, options ?? {}); | ||
} | ||
function parse(text) { | ||
@@ -421,2 +425,2 @@ text = text.toString(); | ||
module.exports = { parse: parse, read: read, createEditor: createEditor }; | ||
module.exports = { parse, read, createEditor, editorFromString }; |
{ | ||
"name": "properties-parser", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "A parser for .properties files written in javascript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,4 +27,5 @@ # node-properties-parser | ||
- `options.separator`: The character used to separate key/values. Defaults to "=". | ||
- `options.path`: Treated the same way as the optional `path` argument. If both are provided the arguement wins. | ||
- `options.callback`: Treated the same way as the optional `callback` parameter. If both are provided the arguement wins. | ||
- `options.path`: Treated the same way as the optional `path` argument. If both are provided the argument wins. | ||
- `options.callback`: Treated the same way as the optional `callback` parameter. If both are provided the argument wins. | ||
- `editorFromString(text[, options])`: creates an `Editor` object from the text string passed in | ||
- `Editor`: The editor object is returned by `createEditor`. Has the following API: | ||
@@ -31,0 +32,0 @@ - `get(key)`: Returns the value currently associated with `key`. |
@@ -158,3 +158,10 @@ var fs = require("fs"); | ||
const editor5 = prop.editorFromString(""); | ||
assert.equal(editor5.toString(), ""); | ||
const editor6 = prop.editorFromString("one=1\ntwo=2"); | ||
assert.equal(editor6.get("one"), "1"); | ||
assert.equal(editor6.get("two"), "2"); | ||
// javac ReadProperties.java | ||
// java ReadProperties test-cases.properties |
23821
483
59