MCPcopy Create free account
hub / github.com/ReactiveX/rxjs / safeOutputPath

Function safeOutputPath

packages/migrate/src/node.ts:174–182  ·  view source on GitHub ↗
(outputRoot: string, outputName: string)

Source from the content-addressed store, hash-verified

172}
173
174function safeOutputPath(outputRoot: string, outputName: string): string {
175 if (!outputName || outputName === '.' || isAbsolute(outputName)) {
176 throw new Error(`Output name must be a non-empty relative path: ${outputName || '<empty>'}`);
177 }
178 const outputPath = resolve(outputRoot, outputName);
179 if (outputPath === outputRoot) throw new Error(`Output name must identify a file below outputRoot: ${outputName}`);
180 assertContained(outputRoot, outputPath, `Output path is outside outputRoot: ${outputName}`);
181 return outputPath;
182}
183
184function assertContained(root: string, candidate: string, message: string): void {
185 const localPath = relative(root, candidate);

Callers 1

planMigrationFilesFunction · 0.85

Calls 1

assertContainedFunction · 0.70

Tested by

no test coverage detected