Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

555 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */
import type { TypedString } from "@/utils/typed";

const PREFIX = "path:";

export type PathPlaceholder = TypedString<"path">;

export function isPath(value: unknown): value is PathPlaceholder {
  if (typeof value !== "string") {
    return false;
  }
  return value.startsWith(PREFIX);
}

export function prefixPath(value: string): PathPlaceholder {
  return `${PREFIX}${value}` as PathPlaceholder;
}

export function unprefixPath(value: PathPlaceholder): string {
  return value.slice(PREFIX.length);
}