diff --git a/README.md b/README.md index 3866d3d..21764a3 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,21 @@ npm install node-units ## Usage -`node-units` comes with a few built in functions: - +### Functions * `importDB(file_name, cb)` - imports a custom unit database, `cb` takes a single argument `err` * `importDBSync(file_name)` - the sync version of `importDB` * `getDB()` - returns he currently used database of units as an object * `convert(type, value, from, to)` - converts `value` of `from` to `to`, returns the result or raises exception if conversion cannot be made +### Properties +* `types` - `types` is an object containing constants for each unit group. + +`types` with the default unit database looks like: +```javascript +{'TIME': 'time', + 'VOLUME': 'volume'}; +``` + ### Simple Usage ```javascript @@ -34,9 +42,9 @@ units.convert(units.types.TIME, 5, 'day', 'second'); With `node-units` you can import custom unit definitions from files defined like the following: ``` group: - long_name,longname,ln 1ln - another_unit,au 5ln - one_more,om 2au + long_name,longname,ln 1ln + another_unit,au 5ln + one_more,om 2au ``` ```javascript @@ -73,4 +81,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.