function aliasFieldsInSelection(prefix, selections, document) {
    return selections.map(function (selection) {
        switch (selection.kind) {
            case graphql.Kind.INLINE_FRAGMENT:
                return aliasFieldsInInlineFragment(prefix, selection, document);
            case graphql.Kind.FRAGMENT_SPREAD: {
                var inlineFragment = inlineFragmentSpread(selection, document);
                return aliasFieldsInInlineFragment(prefix, inlineFragment, document);
            }
            case graphql.Kind.FIELD:
            default:
                return aliasField(selection, prefix);
        }
    });
}
/**
 * Add aliases to fields of the selection, including top-level fields of inline fragments.
 * Fragment spreads are converted to inline fragments and their top-level fields are also aliased.
 *
 * Note that this method is shallow. It adds aliases only to the top-level fields and doesn't
 * descend to field sub-selections.
 *
 * For example, transforms:
 *   {
 *     foo
 *     ... on Query { foo }
 *     ...FragmentWithBarField
 *   }
 * To:
 *   {
 *     graphqlTools1_foo: foo
 *     ... on Query { graphqlTools1_foo: foo }
 *     ... on Query { graphqlTools1_bar: bar }
 *   }
 */
Add aliases to fields of the selection, including top-level fields of inline fragments.
Fragment spreads are converted to inline fragments and their top-level fields are also aliased.

Note that this method is shallow. It adds aliases only to the top-level fields and doesn't
descend to field sub-selections.


Add aliases to fields of the selection including top - level fields of inline fragments . Fragment spreads are converted to inline fragments and their top - level fields are also aliased . Note that this method is shallow . It adds aliases only to the top - level fields and doesn ' t descend to field sub - selections .
function aliasFieldsInSelection(prefix, selections, document) {
    return selections.map(function (selection) {
        switch (selection.kind) {
            case graphql.Kind.INLINE_FRAGMENT:
                return aliasFieldsInInlineFragment(prefix, selection, document);
            case graphql.Kind.FRAGMENT_SPREAD: {
                var inlineFragment = inlineFragmentSpread(selection, document);
                return aliasFieldsInInlineFragment(prefix, inlineFragment, document);
            }
            case graphql.Kind.FIELD:
            default:
                return aliasField(selection, prefix);
        }
    });
}
function aliasFieldsInSelection ( prefix , selections , document ) { return selections . map ( function ( selection ) { switch ( selection . kind ) { case graphql . Kind . INLINE_FRAGMENT : return aliasFieldsInInlineFragment ( prefix , selection , document ) ; case graphql . Kind . FRAGMENT_SPREAD : { var inlineFragment = inlineFragmentSpread ( selection , document ) ; return aliasFieldsInInlineFragment ( prefix , inlineFragment , document ) ; } case graphql . Kind . FIELD : default : return aliasField ( selection , prefix ) ; } } ) ; }
Add aliases to fields of the selection, including top-level fields of inline fragments.
Add aliases to fields of the selection including top - level fields of inline fragments .