Nodejs String Score score()

Here you can find the source of score()

Method Source Code

String.prototype.score = function () {
    return this.replace(/ /g, '_');
};

Related

  1. score(keyword)
    String.prototype.score = function(keyword) {
        if (string == keyword) { return 1.0; }
        if (keyword == "") { return 0; }
        var total_character_score = 0,
            keyword_length = keyword.length,
            string = this,
            string_length = string.length,
            compare_score = 0,
            final_score;
    ...
    
  2. score(search)
    String.prototype.score = function(search) {
      if (search.length == 0 || this.length == 0) { return 0.0; }
      for (var i = search.length; i > 0; i--) {
        var
          subSearch = search.substring(0, i),
          index = this.search(new RegExp("\\b" + subSearch)),
          score = subSearch.length;
        if (index >= 0) {
          score += 1;
    ...