Skip to content

Commit

Permalink
chore(instrumentation-graphql): use es6 syntaxt and strict comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
mentos1386 committed Nov 24, 2021
1 parent 16f650e commit 39be853
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class GraphQLInstrumentation extends InstrumentationBase {
private getOperationType(
operation: graphqlTypes.DefinitionNode | undefined
): string | undefined {
if (operation && operation.kind == 'OperationDefinition') {
if (operation?.kind === 'OperationDefinition') {
return operation.operation;
}

Expand All @@ -404,15 +404,13 @@ export class GraphQLInstrumentation extends InstrumentationBase {
operation: graphqlTypes.DefinitionNode | undefined,
processedArgs: graphqlTypes.ExecutionArgs
): string | undefined {
if operation?.kind === 'OperationDefinition') {
if (operation?.kind === 'OperationDefinition') {
if (operation.name) {
return operation.name.value;
}
}
if (processedArgs.operationName) {
return processedArgs.operationName;
}
return undefined;

return processedArgs.operationName ?? undefined;
}

private _createExecuteSpan(
Expand Down

0 comments on commit 39be853

Please sign in to comment.