Skip to content

Commit b39b47d

Browse files
OverlappingFieldsCanBeMergedRule: futher simplify 'PairSet' (#3108)
1 parent 9b0514a commit b39b47d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/validation/rules/OverlappingFieldsCanBeMergedRule.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ function subfieldConflicts(
781781
}
782782

783783
/**
784-
* A way to keep track of pairs of things when the ordering of the pair does
785-
* not matter. We do this by maintaining a sort of double adjacency sets.
784+
* A way to keep track of pairs of things when the ordering of the pair does not matter.
786785
*/
787786
class PairSet {
788787
_data: Map<string, Map<string, boolean>>;
@@ -798,13 +797,11 @@ class PairSet {
798797
if (result === undefined) {
799798
return false;
800799
}
801-
// areMutuallyExclusive being false is a superset of being true,
802-
// hence if we want to know if this PairSet "has" these two with no
803-
// exclusivity, we have to ensure it was added as such.
804-
if (areMutuallyExclusive === false) {
805-
return result === false;
806-
}
807-
return true;
800+
801+
// areMutuallyExclusive being false is a superset of being true, hence if
802+
// we want to know if this PairSet "has" these two with no exclusivity,
803+
// we have to ensure it was added as such.
804+
return areMutuallyExclusive ? true : areMutuallyExclusive === result;
808805
}
809806

810807
add(a: string, b: string, areMutuallyExclusive: boolean): void {

0 commit comments

Comments
 (0)