What does this path check print?

from Agent instructions and MCP
Node 24 beginner 3 min

What does this path check print?

JavaScript
import { posix } from "node:path";

function verdict(raw) {
  const path = posix.normalize(raw);
  return path.startsWith("src/") && path.endsWith(".ts")
    ? `ALLOW ${path}`
    : `DENY ${path}`;
}

console.log(verdict("src/config.ts"));
console.log(verdict("src/../secrets/token.txt"));
Open in playground
Report an error