1 |
|
2 |
|
3 |
|
4 | export function pick(obj, keys) {
|
5 | for (const key of keys) {
|
6 | if (obj[key]) {
|
7 | return obj[key];
|
8 | }
|
9 | }
|
10 | return obj;
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export function isSchemaText(obj) {
|
17 | return typeof obj === 'string';
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 | export function isWrappedSchemaJson(obj) {
|
23 | const json = obj;
|
24 | return json.data !== undefined && json.data.__schema !== undefined;
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 | export function isSchemaJson(obj) {
|
30 | const json = obj;
|
31 | return json !== undefined && json.__schema !== undefined;
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 | export function isSchemaAst(obj) {
|
37 | return obj.kind !== undefined;
|
38 | }
|