@@ -13,7 +13,7 @@ export type Planet = $ReadOnly<{|
13
13
gravity : string ,
14
14
climate : string ,
15
15
population : number ,
16
- residents : $ReadOnlyArray < number > ,
16
+ residents : $ReadOnlyArray < number > ,
17
17
| } > ;
18
18
19
19
export type Person = $ReadOnly < { |
@@ -32,19 +32,19 @@ export type SpacePeopleClientlibTypes = {|
32
32
const FAKE_PLANETS : $ReadOnlyArray < Planet > = [
33
33
{
34
34
id : 1 ,
35
- name : " Proxima Centauri" ,
35
+ name : ' Proxima Centauri' ,
36
36
diameter : 12000 ,
37
- gravity : " 1 standard" ,
38
- climate : " hot" ,
37
+ gravity : ' 1 standard' ,
38
+ climate : ' hot' ,
39
39
population : 500000 ,
40
40
residents : [ 1 , 2 , 3 ] ,
41
41
} ,
42
42
{
43
43
id : 2 ,
44
- name : " Kepler-186f" ,
44
+ name : ' Kepler-186f' ,
45
45
diameter : 8000 ,
46
- gravity : " 0.8 standard" ,
47
- climate : " icy" ,
46
+ gravity : ' 0.8 standard' ,
47
+ climate : ' icy' ,
48
48
population : 200000 ,
49
49
residents : [ 4 , 5 ] ,
50
50
} ,
@@ -53,58 +53,64 @@ const FAKE_PLANETS: $ReadOnlyArray<Planet> = [
53
53
const FAKE_PEOPLE : $ReadOnlyArray < Person > = [
54
54
{
55
55
id : 1 ,
56
- name : " Alice" ,
56
+ name : ' Alice' ,
57
57
height : 180 ,
58
- hair_color : " blue" ,
58
+ hair_color : ' blue' ,
59
59
home_planet : 1 ,
60
60
} ,
61
61
{
62
62
id : 2 ,
63
- name : " Bob" ,
63
+ name : ' Bob' ,
64
64
height : 175 ,
65
- hair_color : " green" ,
65
+ hair_color : ' green' ,
66
66
home_planet : 1 ,
67
67
} ,
68
68
{
69
69
id : 3 ,
70
- name : " Charlie" ,
70
+ name : ' Charlie' ,
71
71
height : 165 ,
72
- hair_color : " red" ,
72
+ hair_color : ' red' ,
73
73
home_planet : 1 ,
74
74
} ,
75
75
{
76
76
id : 4 ,
77
- name : " Dave" ,
77
+ name : ' Dave' ,
78
78
height : 190 ,
79
- hair_color : " none" ,
79
+ hair_color : ' none' ,
80
80
home_planet : 2 ,
81
81
} ,
82
82
{
83
83
id : 5 ,
84
- name : " Eve" ,
84
+ name : ' Eve' ,
85
85
height : 170 ,
86
- hair_color : " blue" ,
86
+ hair_color : ' blue' ,
87
87
home_planet : 2 ,
88
88
} ,
89
89
] ;
90
90
91
91
function CreateSpacePeopleClientlib ( ) : SpacePeopleClientlibTypes {
92
92
return {
93
- getPlanets : ( { planet_ids } ) = > Promise . resolve ( planet_ids . map ( ( id ) => {
94
- const planet = FAKE_PLANETS . find ( ( p ) => p . id === id ) ;
95
- if ( ! planet ) {
96
- throw new Error ( `Planet with id ${ inspect ( id ) } not found` ) ;
97
- }
98
- return planet ;
99
- } ) ) ,
100
- getPeople : ( { people_ids } ) => Promise . resolve ( people_ids . map ( ( id ) => {
101
- const person = FAKE_PEOPLE . find ( ( p ) => p . id === id ) ;
102
- if ( ! person ) {
103
- throw new Error ( `Person with id ${ inspect ( id ) } not found` ) ;
104
- }
105
- return person ;
106
- } )),
107
- }
108
- } ;
93
+ getPlanets : ( { planet_ids } ) = >
94
+ Promise . resolve (
95
+ planet_ids . map ( ( id ) => {
96
+ const planet = FAKE_PLANETS . find ( ( p ) => p . id === id ) ;
97
+ if ( ! planet ) {
98
+ throw new Error ( `Planet with id ${ inspect ( id ) } not found` ) ;
99
+ }
100
+ return planet ;
101
+ } ) ,
102
+ ) ,
103
+ getPeople : ( { people_ids } ) =>
104
+ Promise . resolve (
105
+ people_ids . map ( ( id ) => {
106
+ const person = FAKE_PEOPLE . find ( ( p ) => p . id === id ) ;
107
+ if ( ! person ) {
108
+ throw new Error ( `Person with id ${ inspect ( id ) } not found` ) ;
109
+ }
110
+ return person ;
111
+ } ),
112
+ ),
113
+ } ;
114
+ }
109
115
110
- module . exports = CreateSpacePeopleClientlib ;
116
+ module . exports = CreateSpacePeopleClientlib ;
0 commit comments