function ghIssueStats(repository, options) {
    options = merge({
        // GitHub API URL, you may change to point to a GitHub enterprise instance
        apiUrl: 'https://api.github.com',
        // Array of API tokens to be used by `token-dealer`
        tokens: null,
        // The concurrency in which pages are requested
        concurrency: 5,
        // Custom options to be passed to `got`
        got: {
            timeout: 15000,
            headers: { accept: 'application/vnd.github.v3+json' },
        },
        // Custom options to be passed to `token-dealer`
        tokenDealer: { group: 'github' },
    }, options);

    const stats = generateEmptyStats();
    const issuesUrl = url.resolve(options.apiUrl, `repos/${repository}/issues?state=all&per_page=100`);

    // Fetch first page
    return doRequest(issuesUrl, options)
    .then((response) => {
        parsePage(response.body, stats);

        // Fetch the remaining pages concurrently
        const remainingPages = getPagesAsArray(response.headers.link).slice(1);
        const actions = remainingPages.map((page) => () =>
            doRequest(`${issuesUrl}&page=${page}`, options)
            .then((response) => parsePage(response.body, stats))
        );

        return pAll(actions, { concurrency: options.concurrency });
    })
    .then(() => stats);
}
function ghIssueStats(repository, options) {
    options = merge({
        
        apiUrl: 'https:
        
        tokens: null,
        
        concurrency: 5,
        
        got: {
            timeout: 15000,
            headers: { accept: 'application/vnd.github.v3+json' },
        },
        
        tokenDealer: { group: 'github' },
    }, options);

    const stats = generateEmptyStats();
    const issuesUrl = url.resolve(options.apiUrl, `repos/${repository}/issues?state=all&per_page=100`);

    
    return doRequest(issuesUrl, options)
    .then((response) => {
        parsePage(response.body, stats);

        
        const remainingPages = getPagesAsArray(response.headers.link).slice(1);
        const actions = remainingPages.map((page) => () =>
            doRequest(`${issuesUrl}&page=${page}`, options)
            .then((response) => parsePage(response.body, stats))
        );

        return pAll(actions, { concurrency: options.concurrency });
    })
    .then(() => stats);
}
function ghIssueStats ( repository , options ) { options = merge ( { // GitHub API URL, you may change to point to a GitHub enterprise instance apiUrl : 'https://api.github.com' , // Array of API tokens to be used by `token-dealer` tokens : null , // The concurrency in which pages are requested concurrency : 5 , // Custom options to be passed to `got` got : { timeout : 15000 , headers : { accept : 'application/vnd.github.v3+json' } , } , // Custom options to be passed to `token-dealer` tokenDealer : { group : 'github' } , } , options ) ; const stats = generateEmptyStats ( ) ; const issuesUrl = url . resolve ( options . apiUrl , ` ${ repository } ` ) ; // Fetch first page return doRequest ( issuesUrl , options ) . then ( ( response ) => { parsePage ( response . body , stats ) ; // Fetch the remaining pages concurrently const remainingPages = getPagesAsArray ( response . headers . link ) . slice ( 1 ) ; const actions = remainingPages . map ( ( page ) => ( ) => doRequest ( ` ${ issuesUrl } ${ page } ` , options ) . then ( ( response ) => parsePage ( response . body , stats ) ) ) ; return pAll ( actions , { concurrency : options . concurrency } ) ; } ) . then ( ( ) => stats ) ; }
-------------------------------------------------
-------------------------------------------------