This repository was archived by the owner on Nov 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,11 @@ when it breaks.
80
80
81
81
## Changelog
82
82
83
+ ** 2.1.0** (2018-06-25):
84
+ * Exported helper function ` prevDay() ` .
85
+
83
86
** 2.0.0** (2018-06-25):
84
- * Exported some helper functions.
87
+ * Exported helper functions ` stringToDate() ` and ` dateToString() ` .
85
88
86
89
** 1.0.0** (2018-06-11):
87
90
* Support for passing a GitHub API key.
Original file line number Diff line number Diff line change @@ -52,4 +52,8 @@ console.log(date); // 2018-05-11T00:00:00.000Z
52
52
53
53
const dateString = githubContribs .dateToString (date);
54
54
console .log (dateString); // 2018-05-11
55
+
56
+ const dayBefore = githubContribs .prevDay (date); // Date() object
57
+ const dayBeforeString = githubContribs .dateToString (dayBefore);
58
+ console .log (dayBeforeString); // 2018-05-10
55
59
```
Original file line number Diff line number Diff line change 33
33
return date . toISOString ( ) . substring ( 0 , 10 ) ;
34
34
} ;
35
35
36
+ // See https://stackoverflow.com/a/25114400/1855917
37
+ const prevDay = date => {
38
+ return new Date ( date . getTime ( ) - ( 24 * 60 * 60 * 1000 ) ) ;
39
+ } ;
40
+
36
41
module . exports = {
37
42
fetch : fetchContribs ,
38
43
stringToDate,
39
- dateToString
44
+ dateToString,
45
+ prevDay
40
46
} ;
41
47
42
48
const fetchRetry = url => {
205
211
return result ;
206
212
} ;
207
213
208
- // See https://stackoverflow.com/a/25114400/1855917
209
- const prevDay = date => {
210
- return new Date ( date . getTime ( ) - ( 24 * 60 * 60 * 1000 ) ) ;
211
- } ;
212
-
213
214
} ) ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @ghuser/github-contribs" ,
3
- "version" : " 2.0 .0" ,
3
+ "version" : " 2.1 .0" ,
4
4
"description" : " List all GitHub repos a user has contributed to since the beginning of time." ,
5
5
"license" : " Unlicense" ,
6
6
"repository" : {
You can’t perform that action at this time.
0 commit comments