<commit_before>/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */

(function () {
  "use strict";

  var _ = X._, _path = X.path;

  /**
    A route is a request handler, or maybe the mapping of a path to a handler

    @class
    @extends X.Object
   */
  X.Route = X.Object.extend(/** @lends X.Route */{
    /**
      Init.

     */
    init: function () {
      //X.debug("X.Route.init(%@)".f(this.get("className")));
      var handles = this.handles, regex, tmp = [];
      regex = /(:[a-z0-9]*)/g;
      _.each(handles, function (handle, idx) {
        var match = handle.match(regex), base, route;
        if (match) {
          base = handle.replace(regex, "([a-z0-9]*)").suf("$");
          base = base.escape();
          tmp.push(new RegExp(base));
        }
      });
      if (tmp.length > 0) handles = handles.concat(tmp);
      this.handles = handles;
    },

    /**
      Handle.<commit_msg>Issue #19028 Change regex paths to use '{xyz}' instead of ':xyz'<commit_after>/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */

(function () {
  "use strict";

  var _ = X._, _path = X.path;

  /**
    A route is a request handler, or maybe the mapping of a path to a handler

    @class
    @extends X.Object
   */
  X.Route = X.Object.extend(/** @lends X.Route */{
    /**
      Init.

     */
    init: function () {
      //X.debug("X.Route.init(%@)".f(this.get("className")));
      var handles = this.handles, regex, tmp = [];
      regex = /({[A-Za-z0-9]*})/g;
      _.each(handles, function (handle, idx) {
        var match = handle.match(regex), base, route;
        if (match) {
          base = handle.replace(regex, "([A-Za-z0-9]*)").suf("$");
          base = base.escape();
          tmp.push(new RegExp(base));
        }
      });
      if (tmp.length > 0) handles = handles.concat(tmp);
      this.handles = handles;
    },

    /**
      Handle.
{'fraction_non_alphanumeric': 0.1859925788497217, 'fraction_numerical': 0.007884972170686457, 'mean_word_length': 2.3650546021840873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5244574', 'n_tokens_mistral': 775, 'n_tokens_neox': 750, 'n_words': 175}