(resolved)
| 43490 | */ |
| 43491 | /* @internal */ |
| 43492 | function parseNodeModuleFromPath(resolved) { |
| 43493 | var path = ts.normalizePath(resolved); |
| 43494 | var idx = path.lastIndexOf(ts.nodeModulesPathPart); |
| 43495 | if (idx === -1) { |
| 43496 | return undefined; |
| 43497 | } |
| 43498 | var indexAfterNodeModules = idx + ts.nodeModulesPathPart.length; |
| 43499 | var indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules); |
| 43500 | if (path.charCodeAt(indexAfterNodeModules) === 64 /* CharacterCodes.at */) { |
| 43501 | indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName); |
| 43502 | } |
| 43503 | return path.slice(0, indexAfterPackageName); |
| 43504 | } |
| 43505 | ts.parseNodeModuleFromPath = parseNodeModuleFromPath; |
| 43506 | function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) { |
| 43507 | var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1); |
no test coverage detected
searching dependent graphs…