<commit_before>/**
 * Utility methods available privately to the package.
 */

Utils = {};

/**
 * global object on node or window object in the browser.
 */

Utils.global = (function () { return this; })();

/**
 * Assert that the given condition is truthy.
 *
 * @param {Boolean} condition The boolean condition to test for truthiness.
 * @param {String} msg The error message to show if the condition is falsy.
 */

Utils.assert = function (condition, msg) {
  if (!condition)
    throw new Error(msg);
};

Utils.warn = function (condition, msg) {
  if (!condition)
    console && console.warn && console.warn(msg);
};

/**
 * deprecatation notice to the user which can be a string or object
 * of the form:
 *
 * {
 *  name: 'somePropertyOrMethod',
 *  where: 'RouteController',
 *  instead: 'someOtherPropertyOrMethod',
 *  message: ':name is deprecated. Please use :instead instead'
 * }
 */
Utils.notifyDeprecated = function (info) {
  var name;
  var instead;
  var message;
  var where;
  var defaultMessage = "[:where] ':name' is deprecated. Please use ':instead' instead.";

  if (_.isObject(info)) {
    name = info.name;
    instead = info.instead;
    message = info.message || defaultMessage;
    where = info.where || 'IronRouter';
  } else {
    message = info;
    name = '';
    instead = '';
    where = '';
  }

  if (typeof console !== 'undefined' && console.warn) {
    console.warn(
      '<deprecated> ' + 
      message
      .replace(':name', name)
      .replace(':instead', instead)
      .replace(':where', where) +
      ' ' +
      (new Error).stack
    );
  }
};

Utils.withDeprecatedNotice = function (info, fn, thisArg) {<commit_msg>Router.configure({supressWarnings: true}) prevents warnings.<commit_after>/**
 * Utility methods available privately to the package.
 */

Utils = {};

/**
 * global object on node or window object in the browser.
 */

Utils.global = (function () { return this; })();

/**
 * Assert that the given condition is truthy.
 *
 * @param {Boolean} condition The boolean condition to test for truthiness.
 * @param {String} msg The error message to show if the condition is falsy.
 */

Utils.assert = function (condition, msg) {
  if (!condition)
    throw new Error(msg);
};

var warn = function (msg) {
  if (Router.options.supressWarnings !== true) {
    console && console.warn && console.warn(msg);
  }
};

Utils.warn = function (condition, msg) {
  if (!condition)
    warn(msg);
};

/**
 * deprecatation notice to the user which can be a string or object
 * of the form:
 *
 * {
 *  name: 'somePropertyOrMethod',
 *  where: 'RouteController',
 *  instead: 'someOtherPropertyOrMethod',
 *  message: ':name is deprecated. Please use :instead instead'
 * }
 */
Utils.notifyDeprecated = function (info) {
  var name;
  var instead;
  var message;
  var where;
  var defaultMessage = "[:where] ':name' is deprecated. Please use ':instead' instead.";

  if (_.isObject(info)) {
    name = info.name;
    instead = info.instead;
    message = info.message || defaultMessage;
    where = info.where || 'IronRouter';
  } else {
    message = info;
    name = '';
    instead = '';
    where = '';
  }

  warn(
      '<deprecated> ' + 
      message
      .replace(':name', name)
      .replace(':instead', instead)
      .replace(':where', where) +
      ' ' +
      (new Error).stack
  );
};

Utils.withDeprecatedNotice = function (info, fn, thisArg) {
{'fraction_non_alphanumeric': 0.14599824098504838, 'fraction_numerical': 0.0, 'mean_word_length': 3.071599045346062, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4063582', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1022, 'n_words': 326}