CB-9835 Downgrade properties-parser to prevent failures in Node < 4.x

This commit is contained in:
Vladimir Kotikov
2015-10-21 13:21:10 +03:00
parent 12c282ce5c
commit 1151856d38
4 changed files with 23 additions and 104 deletions
+1 -4
View File
@@ -22,10 +22,7 @@ Currently works with any version of node.js.
- `parse(text)`: Parses `text` into key-value pairs. Returns an object containing the key-value pairs.
- `read(path[, callback])`: Opens the file specified by `path` and calls `parse` on its content. If the optional `callback` parameter is provided, the result is then passed to it as the second parameter. If an error occurs, the error object is passed to `callback` as the first parameter. If `callback` is not provided, the file specified by `path` is synchronously read and calls `parse` on its contents. The resulting object is immediately returned.
- `createEditor([path][, options][, callback]])`: If neither `path` or `callback` are provided an empty editor object is returned synchronously. If only `path` is provided, the file specified by `path` is synchronously read and parsed. An editor object with the results in then immediately returned. If both `path` and `callback` are provided, the file specified by `path` is read and parsed asynchronously. An editor object with the results are then passed to `callback` as the second parameters. If an error occurs, the error object is passed to `callback` as the first parameter. The following options are supported:
- `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.
- `createEditor([path[, callback]])`: If neither `path` or `callback` are provided an empty editor object is returned synchronously. If only `path` is provided, the file specified by `path` is synchronously read and parsed. An editor object with the results in then immediately returned. If both `path` and `callback` are provided, the file specified by `path` is read and parsed asynchronously. An editor object with the results are then passed to `callback` as the second parameters. If an error occurs, the error object is passed to `callback` as the first parameter.
- `Editor`: The editor object is returned by `createEditor`. Has the following API:
- `get(key)`: Returns the value currently associated with `key`.
- `set(key, [value[, comment]])`: Associates `key` with `value`. An optional comment can be provided. If `value` is not specified or is `null`, then `key` is unset.