11import yargs from "https://deno.land/x/[email protected] /deno.ts" ; 22
3+ // Yeah I'm lazy af
34const print = console . log ;
45const BASE_URL = "https://api.github.com/users/" ;
56
6- class GthUserItem {
7+ type GthUserItem = {
78 count : number ;
89 arr : string [ ] ;
9-
10- constructor ( n : number ) {
11- this . count = n ;
12- this . arr = [ ] ;
13- }
14- }
10+ } ;
1511
1612class GthUser {
17- username : string ;
18- name ?: string ;
19- bio ?: string ;
20- link ?: string ;
21- repos ?: GthUserItem ;
22- gists ?: GthUserItem ;
23- followers ?: GthUserItem ;
24- following ?: GthUserItem ;
25-
26- constructor ( username : string ) {
27- this . username = username ;
28- }
13+ name : string = "" ;
14+ bio : string = "" ;
15+ link : string = "" ;
16+ repos : GthUserItem = { count : 0 , arr : [ ] } ;
17+ gists : GthUserItem = { count : 0 , arr : [ ] } ;
18+ followers : GthUserItem = { count : 0 , arr : [ ] } ;
19+ following : GthUserItem = { count : 0 , arr : [ ] } ;
20+
21+ constructor ( public username : string ) { }
2922
3023 static async create ( user : string ) : Promise < GthUser > {
3124 let self = new GthUser ( user ) ;
@@ -41,10 +34,10 @@ class GthUser {
4134 self . bio = obj . bio ;
4235 self . link = obj . html_url ;
4336
44- self . repos = new GthUserItem ( obj . public_repos ) ;
45- self . gists = new GthUserItem ( obj . public_gists ) ;
46- self . followers = new GthUserItem ( obj . followers ) ;
47- self . following = new GthUserItem ( obj . following ) ;
37+ self . repos . count = obj . public_repos ;
38+ self . gists . count = obj . public_gists ;
39+ self . followers . count = obj . followers ;
40+ self . following . count = obj . following ;
4841
4942 return self ;
5043 }
0 commit comments