Skip to content

Commit 4c36575

Browse files
committed
Revert "set the name of the node to lowercase when assigning it to argument parentName"
This reverts commit 572948e.
1 parent 572948e commit 4c36575

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/analysis/ASTnodefunctions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ export function fieldNode(
3939
// 'resolvedTypeName' is the name of the Schema Type that this field resolves to
4040
const resolvedTypeName =
4141
node.name.value in typeWeights
42-
? node.name.value.toLocaleLowerCase()
42+
? node.name.value
4343
: typeWeights[parentName].fields[node.name.value]?.resolveTo || null;
4444

4545
if (resolvedTypeName) {
4646
// field resolves to an object or a list with possible selections
4747
let selectionsCost = 0;
4848
let calculatedWeight = 0;
49-
const weightFunction = typeWeights[parentName]?.fields[resolvedTypeName]?.weight;
49+
const weightFunction = typeWeights[parentName]?.fields[node.name.value]?.weight;
5050

5151
// call the function to handle selection set node with selectionSet property if it is not undefined
5252
if (node.selectionSet) {
@@ -117,13 +117,14 @@ export function definitionNode(
117117
if (node.operation.toLocaleLowerCase() in typeWeights) {
118118
// if it is, it is an object type, add it's type weight to the total
119119
complexity += typeWeights[node.operation].weight;
120+
// console.log(`the weight of ${node.operation} is ${complexity}`);
120121
// call the function to handle selection set node with selectionSet property if it is not undefined
121122
if (node.selectionSet) {
122123
complexity += selectionSetNode(
123124
node.selectionSet,
124125
typeWeights,
125126
variables,
126-
node.operation.toLocaleLowerCase()
127+
node.operation
127128
);
128129
}
129130
}

0 commit comments

Comments
 (0)