Skip to content

Commit

Permalink
refactor: improved naming
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaringe committed Feb 23, 2025
1 parent 7b7ce94 commit dcefcd5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/merge/src/typedefs-mergers/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const getLinkDirectiveURL = (directive: DirectiveNode): string | undefined => {
};

/**
* Directives by default do not carry distinctual metadata, thus are not
* considered distinct by default by this function. However @link directives are
* only considered distinct if they have different URLs.
* Directives by default do not carry arguments that make them distinct, thus
* are not considered distinct by default by this function. However @link
* directives are only considered distinct if they have different URLs.
*/
const isDirectiveMetadataDistinct = (directiveA: DirectiveNode, directiveB: DirectiveNode) => {
const isDirectiveDistinctByArguments = (directiveA: DirectiveNode, directiveB: DirectiveNode) => {
const isLinkPair = isLinkDirective(directiveA) && isLinkDirective(directiveB);
return isLinkPair ? getLinkDirectiveURL(directiveA) !== getLinkDirectiveURL(directiveB) : false;
};
Expand All @@ -35,7 +35,7 @@ function directiveAlreadyExists(
): boolean {
return !!directivesArr.find(directive => {
const isDirectiveNameMatching = directive.name.value === otherDirective.name.value;
return isDirectiveNameMatching && !isDirectiveMetadataDistinct(directive, otherDirective);
return isDirectiveNameMatching && !isDirectiveDistinctByArguments(directive, otherDirective);
});
}

Expand Down

0 comments on commit dcefcd5

Please sign in to comment.