<commit_before>'use strict'

var util = require('util')
var WebSocketSignaling = require('../../lib/signaling/out-of-band/websocket')

function FilteringWebSocketSignaling (args) {
  if (!(this instanceof FilteringWebSocketSignaling)) {
    return new FilteringWebSocketSignaling(args)
  }
  // init
  this._filter = (args.filter === undefined) ? function () { return false } : args.filter
  WebSocketSignaling.call(this, args)
}

// Inherit EventEmitter
util.inherits(FilteringWebSocketSignaling, WebSocketSignaling)

// do not fire an error when a message was not properly delivered
FilteringWebSocketSignaling.prototype.send = function (message, destinationInfo, onSuccess, onFailure) {
  // if message passes the filter test
  if (this._args.filter(message)) {
    console.log('IGNORING message ' + JSON.stringify(message))
    // then return -- dropping request on the floor
    return
  }
  FilteringWebSocketSignaling.super_.prototype.send.call(this, message, destinationInfo, onSuccess, onFailure)
}

module.exports = FilteringWebSocketSignaling
<commit_msg>bug fix<commit_after>'use strict'

var util = require('util')
var WebSocketSignaling = require('../../../lib/signaling/out-of-band/websocket')

function FilteringWebSocketSignaling (args) {
  if (!(this instanceof FilteringWebSocketSignaling)) {
    return new FilteringWebSocketSignaling(args)
  }
  // init
  this._filter = (args.filter === undefined) ? function () { return false } : args.filter
  WebSocketSignaling.call(this, args)
}

// Inherit EventEmitter
util.inherits(FilteringWebSocketSignaling, WebSocketSignaling)

// do not fire an error when a message was not properly delivered
FilteringWebSocketSignaling.prototype.send = function (message, destinationInfo, onSuccess, onFailure) {
  // if message passes the filter test
  if (this._args.filter(message)) {
    console.log('IGNORING message ' + JSON.stringify(message))
    // then return -- dropping request on the floor
    return
  }
  FilteringWebSocketSignaling.super_.prototype.send.call(this, message, destinationInfo, onSuccess, onFailure)
}

module.exports = FilteringWebSocketSignaling

{'fraction_non_alphanumeric': 0.10756223579145138, 'fraction_numerical': 0.0, 'mean_word_length': 4.8038147138964575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7136500', 'n_tokens_mistral': 603, 'n_tokens_neox': 602, 'n_words': 153}