app/lib/editor/delete-left.mjs
22 lines and 3 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| deleteLeftBehind | 17 to 24 | 3 | 100% | OkCRAP 3 | No data: no mutants in this code |
| <anonymous:21> | 21 to 21 | 1 | 100% | OkCRAP 1 | No data: no mutants in this code |
| <anonymous:22> | 22 to 22 | 1 | 100% | OkCRAP 1 | No data: no mutants in this code |
Imports
It imports no other module of this repo. Imported by app/routes/admin.posts.$slug.edit.tsx, app/routes/admin.posts._index.tsx.
Source
/**
* What a delete from the editor left behind, carried to /admin/posts on the redirect, because the
* editor page no longer exists to say it. Fixed codes, never free text in a URL.
*/
export const DELETE_LEFT_PARAM = "left";
/** @type {Record<string, string>} */
const SENTENCES = {
ask: "Its Ask records were not removed, so Ask can still quote it. Run Sync Ask corpus to prune them.",
purge: "The cache purge failed, so public pages may still show it until their cache expires.",
};
/**
* @param {URLSearchParams} params
* @returns {{ slug: string, problems: string[] } | null}
*/
export function deleteLeftBehind(params) {
const slug = params.get("deleted");
const problems = params
.getAll(DELETE_LEFT_PARAM)
.map((code) => SENTENCES[code])
.filter((sentence) => typeof sentence === "string");
return slug && problems.length > 0 ? { slug, problems } : null;
}