<commit_before>var base64_url_decode = require('./base64_url_decode');
var json_parse = require('./json_parse');

module.exports = function (token) {
  if (!token) {
    return;
  }
  
  return json_parse(base64_url_decode(token.split('.')[1]));
};
<commit_msg>Throw error instead<commit_after>'use strict';

var base64_url_decode = require('./base64_url_decode');
var json_parse = require('./json_parse');

module.exports = function (token) {
  if (!token) {
    throw new Error('Invalid token specified');
  }
  
  return json_parse(base64_url_decode(token.split('.')[1]));
};

{'fraction_non_alphanumeric': 0.16753022452504318, 'fraction_numerical': 0.024179620034542316, 'mean_word_length': 5.170212765957447, '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': '1618643', 'n_tokens_mistral': 198, 'n_tokens_neox': 191, 'n_words': 36}