18 lines
540 B
TypeScript
18 lines
540 B
TypeScript
import sanitize from '../utils/sanitize.ts';
|
|
|
|
export default function by_lurid(id: string): string[] {
|
|
// Replace invalid filename characters and leading dots
|
|
const sanitized_id = sanitize(id);
|
|
|
|
// assuming a lurid, eg: able-fish-cost-them-post-many-form-hope-wife-born
|
|
// ./able-fish-cost-them/able-fish-cost-them-post-many-form/able-fish-cost-them-post-many-form-hope-wife-born.json
|
|
|
|
const result: string[] = [
|
|
sanitized_id.slice(0, 14),
|
|
sanitized_id.slice(0, 34),
|
|
sanitized_id,
|
|
`${sanitized_id}.json`
|
|
];
|
|
|
|
return result;
|
|
}
|