irc-prefix-parser
v1.0.1 irc prefix parser
irc-prefix-parser
Parse IRC message prefixes
Installation
npm install irc-prefix-parser
Usage
The parser takes a string and returns an object with:
raw
- original prefixisServer
- boolean indicating whether or not the prefix is a server. Iffalse
, the prefix is a user.nick
,user
andhost
var parse = require('irc-prefix-parser')
console.log(parse('foobar.freenode.net'))
/* {
* raw: 'foobar.freenode.net',
* isServer: true,
* nick: null
* user: null
* host: 'foobar.freenode.net'
* }
*/
console.log(parse('[email protected]'))
/* {
* raw: '[email protected]',
* isServer: false,
* nick: 'jamie',
* user: 'weechat',
* host: '127.0.0.1'
* }
*/
npm i irc-prefix-parser
Metadata
- MIT
- Whatever
- Fionn Kelleher
- released 3/1/2015