(parent, child, currentDirectory, ignoreCase)
| 8110 | } |
| 8111 | ts.comparePaths = comparePaths; |
| 8112 | function containsPath(parent, child, currentDirectory, ignoreCase) { |
| 8113 | if (typeof currentDirectory === "string") { |
| 8114 | parent = combinePaths(currentDirectory, parent); |
| 8115 | child = combinePaths(currentDirectory, child); |
| 8116 | } |
| 8117 | else if (typeof currentDirectory === "boolean") { |
| 8118 | ignoreCase = currentDirectory; |
| 8119 | } |
| 8120 | if (parent === undefined || child === undefined) |
| 8121 | return false; |
| 8122 | if (parent === child) |
| 8123 | return true; |
| 8124 | var parentComponents = reducePathComponents(getPathComponents(parent)); |
| 8125 | var childComponents = reducePathComponents(getPathComponents(child)); |
| 8126 | if (childComponents.length < parentComponents.length) { |
| 8127 | return false; |
| 8128 | } |
| 8129 | var componentEqualityComparer = ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive; |
| 8130 | for (var i = 0; i < parentComponents.length; i++) { |
| 8131 | var equalityComparer = i === 0 ? ts.equateStringsCaseInsensitive : componentEqualityComparer; |
| 8132 | if (!equalityComparer(parentComponents[i], childComponents[i])) { |
| 8133 | return false; |
| 8134 | } |
| 8135 | } |
| 8136 | return true; |
| 8137 | } |
| 8138 | ts.containsPath = containsPath; |
| 8139 | /** |
| 8140 | * Determines whether `fileName` starts with the specified `directoryName` using the provided path canonicalization callback. |
nothing calls this directly
no test coverage detected
searching dependent graphs…