1 | /**
|
2 | * Copyright (c) 2015-present, Facebook, Inc.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | *
|
8 | */
|
9 |
|
10 | /**
|
11 | * Provided a collection of ASTs, presumably each from different files,
|
12 | * concatenate the ASTs together into batched AST, useful for validating many
|
13 | * GraphQL source files which together represent one conceptual application.
|
14 | */
|
15 | export function concatAST(asts) {
|
16 | var batchDefinitions = [];
|
17 |
|
18 | for (var i = 0; i < asts.length; i++) {
|
19 | var definitions = asts[i].definitions;
|
20 |
|
21 | for (var j = 0; j < definitions.length; j++) {
|
22 | batchDefinitions.push(definitions[j]);
|
23 | }
|
24 | }
|
25 |
|
26 | return {
|
27 | kind: 'Document',
|
28 | definitions: batchDefinitions
|
29 | };
|
30 | } |
\ | No newline at end of file |