Skip to the content

Capsid menu

app/lib/editor/intent.mjs

11 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of intent.mjs
FunctionLinesComplexityCoveredCRAPMutation
readIntent7 to 113100%OkCRAP 3No data: no mutants in this code

Imports

It imports no other module of this repo. Imported by app/lib/editor/action.server.ts, app/lib/editor/frontmatter.ts.

Source

/**
 * No default: a submission with no intent must never become a write. A File is refused, not
 * coerced, since String(file) is "[object File]".
 * @param {{ get(name: string): unknown }} form
 * @returns {string | null} the intent, or null if the submission named none
 */
export function readIntent(form) {
  const raw = form.get("intent");
  if (typeof raw !== "string") return null;
  return raw.length > 0 ? raw : null;
}