erk
erk is
- useful for working with the IRC protocol
- leveraging the powerful PEG.js parser generator for JavaScript
- fully compliant with IRC Message Format RFC 2812 (Section 2.3.1)
- implemented using node.js streams
- supported by an exhaustive test suite
erk is not
- a standalone bot/client
PEG.js parser
erk currently depends on features that have not been published in the publicly
released pegjs-0.7.0
. Developers should note that the current dependency is
installing pegjs via dmajda/pegjs#master
.
After editing peg/parser.pegjs
, it needs to be rebuilt!
$ npm run-script peg
Streams
connect erk to your application using the I/O streams.
erk.Parser — converts an IRC-formatted string to an erk.Message
var erk = stream = ; // create a new parservar parser = ; // create a dummie output streamvar output = objectMode: true; output; // connect to outputparser; // write a messageparser; // empty fields pruned from output//=> {"command":"PING","parameters":["irc.freenode.net"]}
erk.Composer — converts a JavaScript object to an IRC-formatted message
var erk = ; // create a new composervar composer = ; // connect to outputcomposer; // write a messagecomposer; //=> PONG irc.freenode.net
Tests
Any contributions will require tests to support them. Run the tests!
$ npm test
Note: running this command will automatically rebuild the PEG.js parser.