<commit_before>var url = require('url');
//router.js - Provides a system for registering routes for REST APIs.

handlers = { 
  "get" : [], 
  "post" : [],
  "put" : [], 
  "delete" : [], 
  "head" : [], 
  "patch" : [], 
  "options" : [], 
  "trace" : [], 
  "connect" : [] 
}

errorHandler = null;

function cleanURL(url) {
    var splitURL = url.split('/');
    splitURL.shift();
    while (splitURL[splitURL.length-1] === "") {
      splitURL.pop();
    }
    return splitURL.join('/');
}

function matchURL(url, pattern) {
  var params = {}
  var splitURL = cleanURL(url).split('/');
  var splitPattern = pattern.split('/');
  var patternLength = splitPattern.length;
  var urlLength = splitURL.length;
  if (urlLength < patternLength) {
    return null;
  }<commit_msg>Fixed a trimming error that stopped '/*' and '*' being identical, which is acceptable behaviour.<commit_after>var url = require('url');
//router.js - Provides a system for registering routes for REST APIs.

handlers = { 
  "get" : [], 
  "post" : [],
  "put" : [], 
  "delete" : [], 
  "head" : [], 
  "patch" : [], 
  "options" : [], 
  "trace" : [], 
  "connect" : [] 
}

errorHandler = null;

function cleanURL(url) {
    var splitURL = url.split('/');
    
    while (splitURL[0] === "") {
      splitURL.shift();
    }

    while (splitURL[splitURL.length-1] === "") {
      splitURL.pop();
    }
    return splitURL.join('/');
}

function matchURL(url, pattern) {
  var params = {}
  var splitURL = cleanURL(url).split('/');
  var splitPattern = pattern.split('/');
  var patternLength = splitPattern.length;
  var urlLength = splitURL.length;
  if (urlLength < patternLength) {
    return null;
  }
{'fraction_non_alphanumeric': 0.18928571428571428, 'fraction_numerical': 0.0017857142857142857, 'mean_word_length': 2.9739952718676124, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1305707', 'n_tokens_mistral': 579, 'n_tokens_neox': 553, 'n_words': 130}