Skip to content

Commit fe8dd68

Browse files
committedSep 30, 2019
Add direction option
1 parent 10534c7 commit fe8dd68

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
 

‎index.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const fetchRepos = async (url, options = {}, repos = [], page = 1) => {
66
const {body: currentRepos, headers: {link}} = await ghGot(url, {
77
...options,
88
query: {
9+
direction: options.direction,
910
page,
1011
per_page: 100, // eslint-disable-line camelcase
1112
sort: options.sort

‎readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ Default: `full_name`
4545

4646
Can be one of `created`, `updated`, `pushed`, `full_name`.
4747

48+
##### direction
49+
50+
Type: `string`<br>
51+
Default: `asc` when using `full_name`, otherwise `desc`
52+
53+
Can be one of `asc` or `desc`.
54+
4855
##### token
4956

5057
Type: `string`

‎test.js

+5
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ test('`sort` option', async t => {
3636
const repos = await githubRepositories('kevva', {sort: 'created'});
3737
t.is(repos[repos.length - 1].name, 'download');
3838
});
39+
40+
test('`direction` option', async t => {
41+
const [repo] = await githubRepositories('kevva', {direction: 'asc', sort: 'created'});
42+
t.is(repo.name, 'download');
43+
});

0 commit comments

Comments
 (0)
Please sign in to comment.