0.2.5 • Published 9 years ago
jsr-format v0.2.5
Table of Contents
Format Module
Format library used to generate printable output from decoded resp messages.
Component of the jsr library.
Install
npm i jsr-format
API
Convert responses to readable output:
var Format = require('jsr-format').Format
, fmt = new Format();
fmt.convert(new Error('ERR')); // (error) ERR
fmt.convert(null, 10); // (integer) 10
fmt.convert(null, 'foo'); // "foo"
fmt.convert(null, new String('OK')); // OK
Convert the output of CLIENT LIST
to an array of objects:
var ListParser = require('jsr-format').ListParser
, lp = new ListParser();
lp.parse('id=1 age=10\nid=2 age=20'); // [{id: 1, age: 10}, {id: 2, age: 20}]
See the tests for more examples.
Developer
Test
Tests are not included in the package, clone the repository:
npm test
Documentation
To generate all documentation:
npm run docs
Readme
To build the readme file from the partial definitions (requires mdp):
npm run readme
License
Everything is MIT. Read the license if you feel inclined.
Generated by mdp(1).