<commit_before>/**
 * A namespace for utilities related to current route
 * @namespace
 */
CurrentRoute = {};

/**
 * Returns the name of the current route
 * @returns {String}
 */
Object.defineProperty(CurrentRoute, 'name', {
  get: function () {
    return Router.current().route.getName();
  }
});

/**
 * Returns an Array containing parameters passed to the current route.
 *
 * The returned array also has parameter name as property and its value as value.
 * i.e. On '/:date/:slug/' route, CurrentRoute.params.slug gives you the value of
 * the slug parameter.
 * @returns {Array}
 */
Object.defineProperty(CurrentRoute, 'params', {
  get: function () {
    var params = Router.current().params;

    for (var key in params) {
      if (key !== 'hash' && key !== 'query')
        params.push(params[key]);
    }

    return params;
  }
});

/**
 * Tests if the name of the current route is equal to the route name supplied.
 * @param {String} routeName
 * @returns {Boolean}
 */
CurrentRoute.is = function (routeName) {
  return Router.current().route.getName() === routeName;
};
<commit_msg>Avoid mutating the original Router.current().params array<commit_after>/**
 * A namespace for utilities related to current route
 * @namespace
 */
CurrentRoute = {};

/**
 * Returns the name of the current route
 * @returns {String}
 */
Object.defineProperty(CurrentRoute, 'name', {
  get: function () {
    return Router.current().route.getName();
  }
});

/**
 * Returns an Array containing parameters passed to the current route.
 *
 * The returned array also has parameter name as property and its value as value.
 * i.e. On '/:date/:slug/' route, CurrentRoute.params.slug gives you the value of
 * the slug parameter.
 * @returns {Array}
 */
Object.defineProperty(CurrentRoute, 'params', {
  get: function () {
    var result = [];
    var params = Router.current().params;

    for (var key in params) {
      if (key !== 'hash' && key !== 'query') {
        result.push(params[key]);
        console.log(key + ' for ' + params[key]);
        result[key] = params[key];
      }
    }

    return result;
  }
});

/**
 * Tests if the name of the current route is equal to the route name supplied.
 * @param {String} routeName
 * @returns {Boolean}
 */
CurrentRoute.is = function (routeName) {
  return Router.current().route.getName() === routeName;
};

{'fraction_non_alphanumeric': 0.1434634974533107, 'fraction_numerical': 0.0, 'mean_word_length': 3.277676950998185, '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': '3251237', 'n_tokens_mistral': 686, 'n_tokens_neox': 683, 'n_words': 234}