<commit_before>exports.is_current = function(path){
  var newPath = path.replace(/\/index\.html$/, '/');

  return this.path.substring(0, newPath.length) === newPath;
};

exports.is_home = function(){
  var config = this.config || hexo.config,
    r = new RegExp('^' + config.pagination_dir + '\\/\\d+\\/');

  return this.path === '' || r.test(this.path);
};

exports.is_post = function(){
  var config = this.config || hexo.config;

  var rUrl = config.permalink
    .replace(/\//g, '\\/')
    .replace(':id', '\\d+')
    .replace(':category', '(\\w+\\/?)+')
    .replace(':year', '\\d{4}')
    .replace(/:(month|day)/g, '\\d{2}')
    .replace(':title', '[^\\/]+');

  var r = new RegExp('^' + rUrl);

  return r.test(this.path);
};

exports.is_archive = function(){
  var config = this.config || hexo.config,
    r = new RegExp('^' + config.archive_dir + '\\/');<commit_msg>is_current helper added `strict` argument<commit_after>exports.is_current = function(path, strict){
  if (strict){
    if (path[path.length - 1] === '/') path += 'index.html';

    return this.path === path;
  } else {
    path = path.replace(/\/index\.html$/, '/');

    return this.path.substring(0, path.length) === path;
  }
};

exports.is_home = function(){
  var config = this.config || hexo.config,
    r = new RegExp('^' + config.pagination_dir + '\\/\\d+\\/');

  return this.path === '' || r.test(this.path);
};

exports.is_post = function(){
  var config = this.config || hexo.config;

  var rUrl = config.permalink
    .replace(/\//g, '\\/')
    .replace(':id', '\\d+')
    .replace(':category', '(\\w+\\/?)+')
    .replace(':year', '\\d{4}')
    .replace(/:(month|day)/g, '\\d{2}')
    .replace(':title', '[^\\/]+');

  var r = new RegExp('^' + rUrl);

  return r.test(this.path);
};

exports.is_archive = function(){
  var config = this.config || hexo.config,
    r = new RegExp('^' + config.archive_dir + '\\/');
{'fraction_non_alphanumeric': 0.2552521008403361, 'fraction_numerical': 0.003676470588235294, 'mean_word_length': 2.96875, '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': '2453277', 'n_tokens_mistral': 726, 'n_tokens_neox': 703, 'n_words': 133}