UNPKG

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