Skip to content

parseSlugRegistry

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/api/src/docs-repo/sidecar.ts

Parse an existing registry file; tolerate absent/corrupt input by starting empty. "Corrupt" covers BOTH syntactic (bad JSON) AND structural (valid JSON, wrong shape) corruption: every entry is COERCED to the expected shape so a hand-edited/partial-write/migration-renamed file with, say, a missing previousSlugs can never make a later [...entry.previousSlugs] throw and wedge the committer on every reconcile. A malformed entry is repaired, not trusted.

Signature

ts
function parseSlugRegistry(json: string | null | undefined): SlugRegistry

Parameters

NameType
json`string

Returns: SlugRegistry

Was this page helpful?

Download as PDF