<commit_before>'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _request = require('request');

var _request2 = _interopRequireDefault(_request);

var _cheerio = require('cheerio');

var _cheerio2 = _interopRequireDefault(_cheerio);

exports['default'] = function (pack) {
  var limit = arguments[1] === undefined ? 1 : arguments[1];
  var offset = arguments[2] === undefined ? 0 : arguments[2];

  var URL = 'https://www.npmjs.com/';
  var METHOD = 'search?q=' + pack;
  return new Promise(function (resolve, reject) {
    (0, _request2['default'])(URL + METHOD, function (err, res, body) {
      var $ = _cheerio2['default'].load(body);
      var Data = function Data(index) {
        var BASE = '.search-results > li:nth-child(' + index + ') >';
        var result = {};

        result.name = $('' + BASE + ' div:nth-child(1) > h3:nth-child(1) > a:nth-child(1)').attr('href').split('/')[2];
        result.author = $('' + BASE + ' div:nth-child(1) > h3:nth-child(1) > a:nth-child(2)').attr('href').split('/~')[1];
        result.description = $('' + BASE + ' div:nth-child(1) > p:nth-child(2)').text();
        result.stars = $('' + BASE + ' div:nth-child(1) > p:nth-child(3) > span:nth-child(1)').text();
        result.version = $('' + BASE + ' div:nth-child(1) > p:nth-child(3) > span:nth-child(2)').text().slice(1);
        result.html_url = '' + URL + 'package/' + result.name;

        return result;
      };
      try {
        var result = [];
        while (offset < 20 && result.length < limit) {
          result.push(new Data(offset + 1));
          ++offset;
        }
        resolve(result);
      } catch (e) {
        reject(new Error('Package not found'));
      }
    });
  });
};

module.exports = exports['default'];<commit_msg>replace url with html_url<commit_after>'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _request = require('request');

var _request2 = _interopRequireDefault(_request);

var _cheerio = require('cheerio');

var _cheerio2 = _interopRequireDefault(_cheerio);

exports['default'] = function (pack) {
  var limit = arguments[1] === undefined ? 1 : arguments[1];
  var offset = arguments[2] === undefined ? 0 : arguments[2];

  var URL = 'https://www.npmjs.com/';
  var METHOD = 'search?q=' + pack;
  return new Promise(function (resolve, reject) {
    (0, _request2['default'])(URL + METHOD, function (err, res, body) {
      var $ = _cheerio2['default'].load(body);
      var Data = function Data(index) {
        var BASE = '.search-results > li:nth-child(' + index + ') >';
        var result = {};

        result.name = $('' + BASE + ' div:nth-child(1) > h3:nth-child(1) > a:nth-child(1)').attr('href').split('/')[2];
        result.author = $('' + BASE + ' div:nth-child(1) > h3:nth-child(1) > a:nth-child(2)').attr('href').split('/~')[1];
        result.description = $('' + BASE + ' div:nth-child(1) > p:nth-child(2)').text();
        result.stars = $('' + BASE + ' div:nth-child(1) > p:nth-child(3) > span:nth-child(1)').text();
        result.version = $('' + BASE + ' div:nth-child(1) > p:nth-child(3) > span:nth-child(2)').text().slice(1);
        result.url = '' + URL + 'package/' + result.name;

        return result;
      };
      try {
        var result = [];
        while (offset < 20 && result.length < limit) {
          result.push(new Data(offset + 1));
          ++offset;
        }
        resolve(result);
      } catch (e) {
        reject(new Error('Package not found'));
      }
    });
  });
};

module.exports = exports['default'];
{'fraction_non_alphanumeric': 0.20396301188903568, 'fraction_numerical': 0.017437252311756937, 'mean_word_length': 3.0362473347547976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '1927995', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1303, 'n_words': 250}