<commit_before>'use strict';

var cheerio = require('cheerio');
var http = require('http');

/**
 * Get ten most popular screen resolutions
 *
 * @param {Function} cb
 * @api public
 */

module.exports = function (cb) {
    var chunk = '';
    var ret = [];

    http.get('http://www.w3counter.com/globalstats.php', function (res) {
        if (res.statusCode !== 200) {
            cb(res.statusCode);
        }

        res.on('data', function (data) {
            chunk += data;
        });

        res.on('end', function () {
            var $ = cheerio.load(chunk);

            $('th').filter(function () {
                return this.text() === 'Screen Resolutions';
            }).parent().nextAll('.item').each(function () {
                ret.push(this.text());
            });

            cb(null, ret);
        });
    }).on('error', function (err) {
        cb(err);
    });
};<commit_msg>Pass error if array is empty<commit_after>'use strict';

var cheerio = require('cheerio');
var http = require('http');

/**
 * Get ten most popular screen resolutions
 *
 * @param {Function} cb
 * @api public
 */

module.exports = function (cb) {
    var chunk = '';
    var ret = [];

    http.get('http://www.w3counter.com/globalstats.php', function (res) {
        if (res.statusCode !== 200) {
            return cb(res.statusCode);
        }

        res.on('data', function (data) {
            chunk += data;
        });

        res.on('end', function () {
            var $ = cheerio.load(chunk);

            $('th').filter(function () {
                return this.text() === 'Screen Resolutions';
            }).parent().nextAll('.item').each(function () {
                ret.push(this.text());
            });

            if (ret.length === 0) {
                return cb('Couldn\'t get any screen resolutions');
            }

            cb(null, ret);
        });
    }).on('error', function (err) {
        return cb(err);
    });
};
{'fraction_non_alphanumeric': 0.18037812979049567, 'fraction_numerical': 0.004598875830352581, 'mean_word_length': 1.8011444921316166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2024800', 'n_tokens_mistral': 588, 'n_tokens_neox': 561, 'n_words': 126}