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
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| readIntent | 7 to 11 | 3 | 100% | OkCRAP 3 | No 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;
}