irc-parse-line
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

IRC Message Parser

License: MIT

The simplest possible IRC message parser, with the most extensible suite of tests.

Usage:

const { parseIrcLine } = require('irc-parse-line')
parseIrcLine('@tag1=value1;tag2;vendor1/tag3=value2;vendor2/tag4 COMMAND param1 param2 :param3 param3"')
/* Returns the following:
 *    {
 *      tags: [
 *        [ 'tag1', 'value1' ],
 *        [ 'tag2', '' ],
 *        [ 'vendor1/tag3', 'value2' ],
 *        [ 'vendor2/tag4', '' ]
 *      ],
 *      verb: 'COMMAND',
 *      params: [ 'param1', 'param2', 'param3 param3"' ]
 *    }
 */

The object returned by parseIrcLine(line: string) has the following fields:

field name and type description
verb: string command used
servername: string server name (when specified)
source: string source of the message, often the user nick name
user: string user sending the message
host: string source host for this message
tags: [string, string][] IRC message tags
params: [string] IRC message parameters, including trailing parameter

Readme

Keywords

Package Sidebar

Install

npm i irc-parse-line

Weekly Downloads

2

Version

0.1.4

License

MIT

Unpacked Size

8.89 kB

Total Files

5

Last publish

Collaborators

  • kesor6