blob: 905e25ba241b06e66d2673a9a1c4262cbcf52902 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/*** IMPORT ------------------------------------------- ***/
import { parse, print } from "graphql";
/*** EXPORT ------------------------------------------- ***/
export function format(query: string): string {
const trimmed = query.trim();
if (!trimmed)
return query;
try {
return print(parse(query));
} catch {
return query;
}
}
|