@ardatan/relay-compiler
Version:
A compiler tool for building GraphQL-driven applications.
37 lines (30 loc) • 712 B
JavaScript
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
// flowlint ambiguous-object-type:error
;
function argumentContainsVariables(arg) {
if (arg == null) {
return false;
}
switch (arg.kind) {
case 'Variable':
return true;
case 'Literal':
return false;
case 'ListValue':
return arg.items.some(argumentContainsVariables);
case 'ObjectValue':
return arg.fields.some(argumentContainsVariables);
default:
arg.kind;
return false;
}
}
module.exports = argumentContainsVariables;