scratchNamespace

tcmts.core.analyze.scratchNamespace · #ejupejgg · term · runs anywhere

The target namespace of a scratch file, from a // tcm: namespace a.b pragma in its first lines.

import { NAMESPACE_PRAGMA } from "#codebase/tcmts/core/analyze";

export function scratchNamespace(text: string): string | undefined {
  return NAMESPACE_PRAGMA.exec(text.split("\n").slice(0, 5).join("\n"))?.[1];
}

uses

used by