Skip to content

Commit

Permalink
[util] Make hasFocus method more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 7291346 commit 97dad12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@sanity/util/src/pathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export function isSegmentEqual(segmentA: PathSegment, segmentB: PathSegment): bo
}

export function hasFocus(focusPath: Path, path: Path): boolean {
const _withoutFirst =
const withoutTerminator =
focusPath[focusPath.length - 1] === FOCUS_TERMINATOR ? focusPath.slice(0, -1) : focusPath
return isEqual(_withoutFirst, path)
return isEqual(withoutTerminator, path)
}

export function hasItemFocus(focusPath: Path, item: PathSegment): boolean {
Expand Down

0 comments on commit 97dad12

Please sign in to comment.