<commit_before>var jwt = require('jwt-simple');

module.exports = {

  // Getus user from db, returns a promise of that user
  applyToUser: function(user) {
    if (typeof(user) === 'string') {
      user = {username: user};
    }
    return findUser({username: username})
    .then(function (user) {
      if (!user) {
        next(new Error('User does not exist'));
      } else {
        return user;
      }
    });
  },

  errorLogger: function (error, req, res, next) {
    console.error(error.stack);
    next(error);
  },
  errorHandler: function (error, req, res, next) {
    res.send(500, {error: error.message});
  },

  decode: function (req, res, next) {
    var token = req.headers['x-access-token'];
    var user;

    if (!token) {
      return res.send(403); // send forbidden if a token is not provided
    }<commit_msg>Fix and ungodly number of linter errors<commit_after>var jwt = require('jwt-simple');

module.exports = {

  // Getus user from db, returns a promise of that user
  applyToUser: function (user) {
    if ((typeof user) === 'string') {
      user = {username: user};
    }
    return findUser({username: username})
    .then(function (user) {
      if (!user) {
        next(new Error('User does not exist'));
      } else {
        return user;
      }
    });
  },

  errorLogger: function (error, req, res, next) {
    console.error(error.stack);
    next(error);
  },
  errorHandler: function (error, req, res, next) {
    res.send(500, {error: error.message});
  },
  decode: function (req, res, next) {
    var token = req.headers['x-access-token'];
    var user;

    if (!token) {
      return res.send(403); // send forbidden if a token is not provided
    }
{'fraction_non_alphanumeric': 0.15032295948326482, 'fraction_numerical': 0.007046388725778039, 'mean_word_length': 2.641025641025641, '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': '4406556', 'n_tokens_mistral': 556, 'n_tokens_neox': 537, 'n_words': 160}