<commit_before>const parser = require('ua-parser-js');
const slash = '/';
/**
 * 页面变量初始化等
 * @param  {[type]}   req  [description]
 * @param  {[type]}   res  [description]
 * @param  {Function} next [description]
 * @return {[type]}        [description]
 */
module.exports = function pageInfo(req, res, next) {
  const pathname = req.pathname.replace(slash, '');
  const firstSlash = pathname.indexOf(slash);

  const moduleName = pathname.substr(0, firstSlash);
  const ua = parser(req.get('User-Agent'));

  Object.assign(req, {
    ua,
    moduleName
  });

  res.locals.request = req;
  res.locals.app = req.app;

  next();
};<commit_msg>remove res.locals.app<commit_after>const parser = require('ua-parser-js');
const slash = '/';
/**
 * 页面变量初始化等
 * @param  {[type]}   req  [description]
 * @param  {[type]}   res  [description]
 * @param  {Function} next [description]
 * @return {[type]}        [description]
 */
module.exports = function pageInfo(req, res, next) {
  const pathname = req.pathname.replace(slash, '');
  const firstSlash = pathname.indexOf(slash);

  const moduleName = pathname.substr(0, firstSlash);
  const ua = parser(req.get('User-Agent'));

  Object.assign(req, {
    ua,
    moduleName
  });

  res.locals.request = req;

  next();
};
{'fraction_non_alphanumeric': 0.17325949367088608, 'fraction_numerical': 0.0015822784810126582, 'mean_word_length': 3.650735294117647, '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': '4969102', 'n_tokens_mistral': 454, 'n_tokens_neox': 439, 'n_words': 93}