New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jerk

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jerk - npm Package Compare versions

Comparing version 1.1.11 to 1.1.12

examples/simple.js

68

lib/jerk.js
var sys = require( 'sys' )
, path = require( 'path' )
, fs = require( 'fs' )
, util = require('util')
, IRC

@@ -16,8 +17,12 @@ , Jerk

, watchers = []
, join_watchers = []
, leave_watchers = []
, connect = _connect.bind( this )
, watch_for = _watch_for.bind( this )
, user_join = _user_join.bind(this)
, user_leave = _user_leave.bind(this)
/* ------------------------------ Public Methods ------------------------------ */
this.addWatchers = function( block ) {
block( { watch_for: watch_for } )
block( { watch_for: watch_for, user_join: user_join, user_leave: user_leave} )
return { connect: connect }

@@ -31,2 +36,5 @@ }

.on( 'privmsg', _receive_message.bind( this ) )
.on( 'join', _user_joined.bind( this ) )
.on( 'part', _user_leaving.bind( this ) )
.on( 'quit', _user_leaving.bind( this ) )
.on( 'error', function( message ) {

@@ -37,3 +45,2 @@ console.log( 'There was an error! "' + message.params[0] + '"' )

.connect( _on_connect.bind( bot ) )
return { say: _privmsg_protected.bind( this )

@@ -72,23 +79,39 @@ , action: _bot_do( function( to, msg ) { return bot.privmsg( to, '\001ACTION ' + msg + '\001' ) } ).bind( this )

function _user_join( hollaback ) {
join_watchers.push( hollaback )
}
function _user_leave( hollaback ) {
leave_watchers.push( hollaback )
}
function _receive_message( message ) {
var i = watchers.length
, source = message.params[0] == bot.options.nick ? message.person.nick : message.params[0]
, text = message.params.slice( -1 ).toString()
, md
while ( i-- )
// If a match is found
if ( md = text.match( watchers[i][0] ) )
watchers[i][1](
{ say: _privmsg_protected.bind( this, source )
, msg: _privmsg_protected.bind( this, message.person.nick )
, match_data: md
, user: message.person.nick
, source: source
, text: message.params.slice( -1 )
, toString: _to_string
}
)
if ( md = message.params.slice( -1 ).toString().match( watchers[i][0] ) )
watchers[i][1]( _make_message( message, md ) )
}
function _user_joined( message ) {
if ( message.person.nick == bot.options.nick )
return
var i = join_watchers.length
while ( i-- )
join_watchers[i]( _make_message( message ) )
}
function _user_leaving( message ) {
if ( message.person.nick == bot.options.nick )
return
var i = leave_watchers.length
while ( i-- )
leave_watchers[i]( _make_message( message ) )
}
function _bot_do( what ) {

@@ -109,2 +132,15 @@ if ( typeof what === 'string' )

function _make_message ( message, md ) {
var source = message.params[0] == bot.options.nick ? message.person.nick : message.params[0]
return true,
{ say: _privmsg_protected.bind( this, source )
, msg: _privmsg_protected.bind( this, message.person.nick )
, match_data: md || []
, user: message.person.nick
, source: source
, text: message.params.slice( -1 )
, toString: _to_string
}
}
})()

@@ -111,0 +147,0 @@

@@ -7,5 +7,6 @@ { "name" : "jerk"

, "Arnaud Berthomier <oz@cyprio.net> (http://wtf.cyprio.net)"
, "Suresh Harikrishnan <suresh.harikrishnan@gmail.com> (http://www.activesphere.com)"
]
, "homepage" : "http://github.com/gf3/Jerk"
, "version" : "1.1.11"
, "version" : "1.1.12"
, "main" : "./lib/jerk"

@@ -12,0 +13,0 @@ , "dependencies" :

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc