Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]
import path from "node:path";
function isPathInsideRoot(candidate: string, root: string): boolean {
const relative = path.relative(path.resolve(root), path.resolve(candidate));
return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
}
export function isOwningNpmCommand(value: unknown, owningPrefix: string): boolean {
if (typeof value !== "string" || !path.isAbsolute(value)) {
return false;
}
const normalized = path.normalize(value);
return (
normalized !== path.normalize("npm") &&
isPathInsideRoot(normalized, owningPrefix) &&
/npm(?:\.cmd)?$/i.test(normalized)
);
}
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet am 2026-04-28)
¤
*© Formatika GbR, Deutschland