Skip to content

Commit 412a702

Browse files
committed
pre-commit
1 parent 0e32ca2 commit 412a702

File tree

5 files changed

+694
-751
lines changed

5 files changed

+694
-751
lines changed

examples/spaceapi-flow/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build
2-
flow-typed
2+
flow-typed

examples/spaceapi-flow/clientlib.js

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type Planet = $ReadOnly<{|
1313
gravity: string,
1414
climate: string,
1515
population: number,
16-
residents: $ReadOnlyArray <number>,
16+
residents: $ReadOnlyArray<number>,
1717
|}>;
1818

1919
export type Person = $ReadOnly<{|
@@ -32,19 +32,19 @@ export type SpacePeopleClientlibTypes = {|
3232
const FAKE_PLANETS: $ReadOnlyArray<Planet> = [
3333
{
3434
id: 1,
35-
name: "Proxima Centauri",
35+
name: 'Proxima Centauri',
3636
diameter: 12000,
37-
gravity: "1 standard",
38-
climate: "hot",
37+
gravity: '1 standard',
38+
climate: 'hot',
3939
population: 500000,
4040
residents: [1, 2, 3],
4141
},
4242
{
4343
id: 2,
44-
name: "Kepler-186f",
44+
name: 'Kepler-186f',
4545
diameter: 8000,
46-
gravity: "0.8 standard",
47-
climate: "icy",
46+
gravity: '0.8 standard',
47+
climate: 'icy',
4848
population: 200000,
4949
residents: [4, 5],
5050
},
@@ -53,58 +53,64 @@ const FAKE_PLANETS: $ReadOnlyArray<Planet> = [
5353
const FAKE_PEOPLE: $ReadOnlyArray<Person> = [
5454
{
5555
id: 1,
56-
name: "Alice",
56+
name: 'Alice',
5757
height: 180,
58-
hair_color: "blue",
58+
hair_color: 'blue',
5959
home_planet: 1,
6060
},
6161
{
6262
id: 2,
63-
name: "Bob",
63+
name: 'Bob',
6464
height: 175,
65-
hair_color: "green",
65+
hair_color: 'green',
6666
home_planet: 1,
6767
},
6868
{
6969
id: 3,
70-
name: "Charlie",
70+
name: 'Charlie',
7171
height: 165,
72-
hair_color: "red",
72+
hair_color: 'red',
7373
home_planet: 1,
7474
},
7575
{
7676
id: 4,
77-
name: "Dave",
77+
name: 'Dave',
7878
height: 190,
79-
hair_color: "none",
79+
hair_color: 'none',
8080
home_planet: 2,
8181
},
8282
{
8383
id: 5,
84-
name: "Eve",
84+
name: 'Eve',
8585
height: 170,
86-
hair_color: "blue",
86+
hair_color: 'blue',
8787
home_planet: 2,
8888
},
8989
];
9090

9191
function CreateSpacePeopleClientlib(): SpacePeopleClientlibTypes {
9292
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+
}
109115

110-
module.exports = CreateSpacePeopleClientlib;
116+
module.exports = CreateSpacePeopleClientlib;

0 commit comments

Comments
 (0)