为什么我们需要按asc排序?

时间:2018-11-03 16:31:38

标签: object constructor javascript-events

class Github {
    constructor() {
        this.client_id = '44b38368d3defba969d5';
        this.client_secret = '1bd40274a7e6b9baa847935eaba35e2b7c325ec4';
        this.repos_count = 5;
        this.repos_sort = 'created: asc';

    }

    async getUser(user) {
        const profileResponse = await fetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secret=${this.client_secret}`);

        const repoResponse = await fetch(`https://api.github.com/users/${user}/repos?per_page=${this.repos_count}&sort=${this.repos_sort}&client_id=${this.client_id}&client_secret=${this.client_secret}`);

        const profile = await profileResponse.json();
        const repos = await repoResponse.json();

        return {
            profile,
            repos
        }
    }
}

请在此说明排序方法ASC的用法。基本上,我还需要对Github存储库进行排序。

0 个答案:

没有答案