All files / src/utils is-child-path-of.ts

100% Statements 10/10
100% Branches 2/2
100% Functions 5/5
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 715x 57x 377x 582x 322x    
export default (parent: string) => (child: string): boolean => {
  if (child === parent) return false
  const parentTokens = parent.split('/').filter(i => i.length)
  const childTokens = child.split('/').filter(i => i.length)
  return parentTokens.every((t, i) => childTokens[i] === t)
}