<commit_before>/**
 * Timeago is a jQuery plugin that makes it easy to support automatically
 * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
 * 
 * Please note that the library has been slightly modified for i18n's sake.
 * 
 *
 * @name timeago
 * @version 0.11.3
 * @requires jQuery v1.2.3+
 * @author <NAME>
 * @license MIT License - http://www.opensource.org/licenses/mit-license.php
 *
 * For usage and examples, visit:
 * http://timeago.yarp.com/
 *
 * Copyright (c) 2008-2012, <NAME> (ryan -[at]- mcgeary [*dot*] org)
 */
(function($) {
  $.timeago = function(timestamp) {
    if (timestamp instanceof Date) {
      return inWords(timestamp);
    } else if (typeof timestamp === "string") {
      return inWords($.timeago.parse(timestamp));
    } else if (typeof timestamp === "number") {
      return inWords(new Date(timestamp));
    } else {
      return inWords($.timeago.datetime(timestamp));
    }
  };
  var $t = $.timeago;

  $.extend($.timeago, {
    settings: {
      refreshMillis: 60000,
      allowFuture: false,
      strings: {
        prefixAgo: null,
        prefixFromNow: null,
        suffixAgo: "ago",
        suffixFromNow: "from now",
        seconds: "less than a minute",
        minute: "about a minute",
        minutes: "%d minutes",
        hour: "about an hour",
        hours: "about %d hours",
        day: "a day",
        days: "%d days",
        month: "about a month",
        months: "%d months",
        year: "about a year",
        years: "%d years",
        wordSeparator: " ",
        numbers: []
      },
      translator: null
    },
    inWords: function(distanceMillis) {
      var $l = this.settings.strings;
      var prefix = $l.prefixAgo;
      var suffix = $l.suffixAgo;
      if (this.settings.allowFuture) {
        if (distanceMillis < 0) {
          prefix = $l.prefixFromNow;
          suffix = $l.suffixFromNow;
        }
      }

      var seconds = Math.abs(distanceMillis) / 1000;
      var minutes = seconds / 60;
      var hours = minutes / 60;
      var days = hours / 24;
      var years = days / 365;

      function substitute(stringOrFunction, number) {
        var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
        
        // return the proper string and the numeric value that goes in it
        return stringAndNumber = {'string': string, 'value': ($l.numbers && $l.numbers[number]) || number};
      }

      var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
        seconds < 90 && substitute($l.minute, 1) ||
        minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
        minutes < 90 && substitute($l.hour, 1) ||
        hours < 24 && substitute($l.hours, Math.round(hours)) ||
        hours < 42 && substitute($l.day, 1) ||
        days < 30 && substitute($l.days, Math.round(days)) ||
        days < 45 && substitute($l.month, 1) ||
        days < 365 && substitute($l.months, Math.round(days / 30)) ||
        years < 1.5 && substitute($l.year, 1) ||
        substitute($l.years, Math.round(years));
      
      var string = stringAndNumber.string;
      var value = stringAndNumber.value;
      var separator = $l.wordSeparator === undefined ?  " " : $l.wordSeparator;
      
      // compose and translate the final string<commit_msg>[IMP] continue refactoring timeago.js, following the conversation on this pull request: https://github.com/rmm5t/jquery-timeago/pull/83 - remove bad usage of global variable stringAndNumber - use a consistent name for the substitute() function which was actully not substituing anything anymore<commit_after>/**
 * Timeago is a jQuery plugin that makes it easy to support automatically
 * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
 * 
 * Please note that the library has been slightly modified for i18n's sake.
 *
 * @name timeago
 * @version 0.11.3
 * @requires jQuery v1.2.3+
 * @author <NAME>
 * @license MIT License - http://www.opensource.org/licenses/mit-license.php
 *
 * For usage and examples, visit:
 * http://timeago.yarp.com/
 *
 * Copyright (c) 2008-2012, <NAME> (ryan -[at]- mcgeary [*dot*] org)
 */
(function($) {
  $.timeago = function(timestamp) {
    if (timestamp instanceof Date) {
      return inWords(timestamp);
    } else if (typeof timestamp === "string") {
      return inWords($.timeago.parse(timestamp));
    } else if (typeof timestamp === "number") {
      return inWords(new Date(timestamp));
    } else {
      return inWords($.timeago.datetime(timestamp));
    }
  };
  var $t = $.timeago;

  $.extend($.timeago, {
    settings: {
      refreshMillis: 60000,
      allowFuture: false,
      strings: {
        prefixAgo: null,
        prefixFromNow: null,
        suffixAgo: "ago",
        suffixFromNow: "from now",
        seconds: "less than a minute",
        minute: "about a minute",
        minutes: "%d minutes",
        hour: "about an hour",
        hours: "about %d hours",
        day: "a day",
        days: "%d days",
        month: "about a month",
        months: "%d months",
        year: "about a year",
        years: "%d years",
        wordSeparator: " ",
        numbers: []
      },
      translator: null
    },
    inWords: function(distanceMillis) {
      var $l = this.settings.strings;
      var prefix = $l.prefixAgo;
      var suffix = $l.suffixAgo;
      if (this.settings.allowFuture) {
        if (distanceMillis < 0) {
          prefix = $l.prefixFromNow;
          suffix = $l.suffixFromNow;
        }
      }

      var seconds = Math.abs(distanceMillis) / 1000;
      var minutes = seconds / 60;
      var hours = minutes / 60;
      var days = hours / 24;
      var years = days / 365;

      function convert(stringOrFunction, number) {
        var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
        
        // return the proper string and the numeric value that goes in it
        return {'string': string, 'value': ($l.numbers && $l.numbers[number]) || number};
      }

      var stringAndNumber = seconds < 45 && convert($l.seconds, Math.round(seconds)) ||
        seconds < 90 && convert($l.minute, 1) ||
        minutes < 45 && convert($l.minutes, Math.round(minutes)) ||
        minutes < 90 && convert($l.hour, 1) ||
        hours < 24 && convert($l.hours, Math.round(hours)) ||
        hours < 42 && convert($l.day, 1) ||
        days < 30 && convert($l.days, Math.round(days)) ||
        days < 45 && convert($l.month, 1) ||
        days < 365 && convert($l.months, Math.round(days / 30)) ||
        years < 1.5 && convert($l.year, 1) ||
        convert($l.years, Math.round(years));
      
      var string = stringAndNumber.string;
      var value = stringAndNumber.value;
      var separator = $l.wordSeparator === undefined ?  " " : $l.wordSeparator;
      
      // compose and translate the final string
{'fraction_non_alphanumeric': 0.14023950367912277, 'fraction_numerical': 0.019477708844322608, 'mean_word_length': 2.411417322834646, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, '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': '6124576', 'n_tokens_mistral': 2205, 'n_tokens_neox': 2043, 'n_words': 603}