{"size": 1339, "ext": "js", "max_stars_repo_path": "src/lib/stringprototype.js", "max_stars_repo_name": "CyberFlameGO/dragonfly", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:32:43.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-25T04:38:18.000Z", "max_issues_repo_path": "src/lib/stringprototype.js", "max_issues_repo_name": "CyberFlameGO/dragonfly", "max_issues_repo_issues_event_min_datetime": "2015-01-23T22:10:00.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-30T18:55:21.000Z", "max_forks_repo_path": "src/lib/stringprototype.js", "max_forks_repo_name": "CyberFlameGO/dragonfly", "max_forks_repo_forks_event_min_datetime": "2015-01-22T15:10:51.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-31T21:45:06.000Z"}
{"max_stars_count": 58, "max_issues_count": 7, "max_forks_count": 24, "avg_line_length": 22.3166666667, "max_line_length": 78, "alphanum_fraction": 0.643764003}
﻿if (!"".trim)
{
  String.prototype.trim = function()
  {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  }
}

/**
 * Check if a string appears to be a number, that is, all letters in the
 * string are numbers. Does not take in to account decimals. Clones the
 * behaviour of str.isdigit in python
 */
String.prototype.isdigit = function()
{
  return this.length && !(/\D/.test(this));
};

String.prototype.startswith = function(str)
{
  return this.slice(0, str.length) === str;
};

String.prototype.endswith = function(str)
{
  return this.slice(this.length - str.length) === str;
};

String.prototype.zfill = function(width)
{
  return this.replace(/(^[+-]?)(.+)/, function(str, sign, rest) {
    var fill = Array(Math.max(width - str.length + 1, 0)).join(0);
    return sign + fill + rest;
  });
};

String.prototype.ljust = function(width, char)
{
  return this + Array(Math.max(width - this.length + 1, 0)).join(char || ' ');
};

/**
 * Capitalizes the first character of the string. Lowercases the rest of
 * the characters, unless `only_first` is true.
 */
String.prototype.capitalize = function(only_first)
{
  var rest = this.slice(1);
  if (!only_first)
  {
    rest = rest.toLowerCase();
  }
  return this[0].toUpperCase() + rest;
};

String.prototype.contains = function(str)
{
  return this.indexOf(str) != -1;
};
