<commit_before>'use strict';

var assert = require('assert');
var async = require('async');
var log = require('loglevel');
var auth = require('./lib/auth.js');
var helpers = require('./lib/helpers.js');

function Meeseeks(opts) {
  var _this = this;
  opts = opts || {};
  this.opts = {};
  this.opts.name = opts.name || ('meeseeks:' + Math.random());
  this.opts.jwtSigningToken = opts.jwtSigningToken || '';
  this.opts.skipJwtValidation = opts.skipJwtValidation || (process.env.NODE_ENV === 'development');
  this.opts.logLevel = opts.logLevel || helpers.logLevelFromEnv();
  this.log = log.getLogger(this.opts.name);
  this.log.setLogLevel(this.opts.logLevel);
  Object.defineProperty(this, 'handler', {
    value: function(event, context) {
      this.debug('Event Received', JSON.stringify(event, null, 2));
      var meeseeksContext = _this.createContextFromEvent(event);
      var origin = { event: event, context: context };
      _this._invoke(meeseeksContext, origin);
    },
  });
  this._listeners = {};
  this.log.info('Handler "' + this.opts.name + '" Ready');
}

Meeseeks.prototype.define = function(name, definition) {
  if (this._listeners[name]) throw new Error('Meeseeks: Listener already exists for "' + name + '"');
  this.log.info('Defined "' + name + '"');
  this._listeners[name] = definition;
};

Meeseeks.prototype.createContextFromEvent = function(event) {
  var authorization = auth.verify(this.opts.jwtSigningToken, event.token, this.opts.skipJwtValidation);
  var meeseeksContext = {
    name: event.method,
    body: event.body || {},
    authorization: authorization,
    identity: authorization.sub,
    received: helpers.now(),
  };<commit_msg>fix fn name<commit_after>'use strict';

var assert = require('assert');
var async = require('async');
var log = require('loglevel');
var auth = require('./lib/auth.js');
var helpers = require('./lib/helpers.js');

function Meeseeks(opts) {
  var _this = this;
  opts = opts || {};
  this.opts = {};
  this.opts.name = opts.name || ('meeseeks:' + Math.random());
  this.opts.jwtSigningToken = opts.jwtSigningToken || '';
  this.opts.skipJwtValidation = opts.skipJwtValidation || (process.env.NODE_ENV === 'development');
  this.opts.logLevel = opts.logLevel || helpers.logLevelFromEnv();
  this.log = log.getLogger(this.opts.name);
  this.log.setLevel(this.opts.logLevel);
  Object.defineProperty(this, 'handler', {
    value: function(event, context) {
      this.debug('Event Received', JSON.stringify(event, null, 2));
      var meeseeksContext = _this.createContextFromEvent(event);
      var origin = { event: event, context: context };
      _this._invoke(meeseeksContext, origin);
    },
  });
  this._listeners = {};
  this.log.info('Handler "' + this.opts.name + '" Ready');
}

Meeseeks.prototype.define = function(name, definition) {
  if (this._listeners[name]) throw new Error('Meeseeks: Listener already exists for "' + name + '"');
  this.log.info('Defined "' + name + '"');
  this._listeners[name] = definition;
};

Meeseeks.prototype.createContextFromEvent = function(event) {
  var authorization = auth.verify(this.opts.jwtSigningToken, event.token, this.opts.skipJwtValidation);
  var meeseeksContext = {
    name: event.method,
    body: event.body || {},
    authorization: authorization,
    identity: authorization.sub,
    received: helpers.now(),
  };
{'fraction_non_alphanumeric': 0.16641813301521025, 'fraction_numerical': 0.0005964807634953773, 'mean_word_length': 4.298578199052133, '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': '3162394', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1077, 'n_words': 206}