0.2.0 • Published 9 years ago

erk v0.2.0

Weekly downloads
4
License
BSD-2-Clause
Repository
github
Last release
9 years ago

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 = require("erk"),
    stream = require("stream");

// create a new parser
var parser = new erk.Parser();

// create a dummie output stream
var output = new stream.PassThrough({objectMode: true});

output.on("data", function(message) {
  console.log(JSON.stringify(message));
});

// connect to output
parser.pipe(output);

// write a message
parser.write("PING :irc.freenode.net\r\n");

// empty fields pruned from output
//=> {"command":"PING","parameters":["irc.freenode.net"]}

erk.Composer converts a JavaScript object to an IRC-formatted message

var erk = require("erk");

// create a new composer
var composer = new erk.Composer();

// connect to output
composer.pipe(process.stdout);

// write a message
composer.write({command: "PONG", parameters: ["irc.freenode.net"]});

//=> 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.

0.2.0

9 years ago

0.1.10

10 years ago

0.1.9

11 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago