Skip to content

Commit a854267

Browse files
committed
improve readability
1 parent 343f0c5 commit a854267

File tree

1 file changed

+5
-5
lines changed
  • packages/compass-data-modeling/src/utils

1 file changed

+5
-5
lines changed

packages/compass-data-modeling/src/utils/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export function isSameFieldOrAncestor(
1414
if (ancestor.length === child.length)
1515
return areFieldPathsEqual(ancestor, child);
1616
if (ancestor.length > child.length) return false;
17-
const pathAncestor = JSON.stringify(ancestor);
18-
const pathChild = JSON.stringify(child);
1917
// ignore the last character - closing bracket
20-
return (
21-
pathAncestor.slice(0, pathAncestor.length - 1) ===
22-
pathChild.slice(0, pathAncestor.length - 1)
18+
const ancestorPath = JSON.stringify(ancestor).slice(0, -1);
19+
const beginningOfchildPath = JSON.stringify(child).slice(
20+
0,
21+
ancestorPath.length
2322
);
23+
return ancestorPath === beginningOfchildPath;
2424
}
2525

2626
export function isRelationshipOfAField(

0 commit comments

Comments
 (0)