lib/index.js
function trending () {

    var language;
    var timespan;
    var callback;

    if (arguments.length === 3) {
        language = arguments[0];
        timespan = arguments[1];
        callback = arguments[2];
    }
    else if (arguments.length === 2) {
        language = arguments[0];
        callback = arguments[1];
    }
    else {
        callback = arguments[0];
    }

    language = (language || 'all').toLowerCase();
    timespan = timespan || 'daily';

    function onResponse (err, html) {
        var repositories;

        if (err) {
            return callback(new VError(err, 'failed to fetch trending repositories (language: %s).', language));
        }

        repositories = scraper.repositories(html);

        callback(null, repositories);
    }

    mandatory(callback)
        .is('function', 'Please define a proper callback function.');

    request(endpoint, { l: language, since: timespan }, onResponse);
}
function trending () {

    var language;
    var timespan;
    var callback;

    if (arguments.length === 3) {
        language = arguments[0];
        timespan = arguments[1];
        callback = arguments[2];
    }
    else if (arguments.length === 2) {
        language = arguments[0];
        callback = arguments[1];
    }
    else {
        callback = arguments[0];
    }

    language = (language || 'all').toLowerCase();
    timespan = timespan || 'daily';

    function onResponse (err, html) {
        var repositories;

        if (err) {
            return callback(new VError(err, 'failed to fetch trending repositories (language: %s).', language));
        }

        repositories = scraper.repositories(html);

        callback(null, repositories);
    }

    mandatory(callback)
        .is('function', 'Please define a proper callback function.');

    request(endpoint, { l: language, since: timespan }, onResponse);
}
function trending ( ) { var language ; var timespan ; var callback ; if ( arguments . length === 3 ) { language = arguments [ 0 ] ; timespan = arguments [ 1 ] ; callback = arguments [ 2 ] ; } else if ( arguments . length === 2 ) { language = arguments [ 0 ] ; callback = arguments [ 1 ] ; } else { callback = arguments [ 0 ] ; } language = ( language || 'all' ) . toLowerCase ( ) ; timespan = timespan || 'daily' ; function onResponse ( err , html ) { var repositories ; if ( err ) { return callback ( new VError ( err , 'failed to fetch trending repositories (language: %s).' , language ) ) ; } repositories = scraper . repositories ( html ) ; callback ( null , repositories ) ; } mandatory ( callback ) . is ( 'function' , 'Please define a proper callback function.' ) ; request ( endpoint , { l : language , since : timespan } , onResponse ) ; }
Grabs the trending repositories of a particular language.

@param {string} language
The language for which the trending repos should be fetched.

@param {function} callback
Will be invoked when the trending repository
data has been fetched. Invoked as `callback(err, repositories)`.
Grabs the trending repositories of a particular language .