app/lib/series-path.mjs
25 lines and 2 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| seriesSlug | 12 to 17 | 1 | 100% | OkCRAP 1 | No data: no mutants in this code |
| seriesPath | 25 to 27 | 1 | 100% | OkCRAP 1 | No data: no mutants in this code |
Imports
It imports no other module of this repo. Imported by app/components/admin/title-slug-row.tsx, app/components/post-series-nav.tsx, app/db/posts.ts, app/lib/feed-response.ts, app/lib/nav.ts, app/lib/site-urls.server.ts, app/routes/blog.series.$series.tsx.
Source
/**
* A series is FREE TEXT, unlike a tag, so it is normalised here and nowhere else; the archive
* builds and resolves its URL through this one function so the two cannot drift.
*/
/**
* Empty for a name with no alphanumerics; the caller decides what that means.
*
* @param {string} name
* @returns {string}
*/
export function seriesSlug(name) {
return name
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
}
/**
* Takes the NAME, so no caller can forget to slugify and put two spellings of one URL on the site.
*
* @param {string} name
* @returns {string} a site-absolute path
*/
export function seriesPath(name) {
return `/writing/series/${encodeURIComponent(seriesSlug(name))}`;
}