diff --git a/src/util.ts b/src/util.ts index 172c9959..1ccc0f44 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,4 +1,4 @@ -import type {KnownUrl} from './types.js'; +import type {KnownUrl, ModuleReplacement} from './types.js'; export function resolveDocUrl(url?: KnownUrl): string | null { if (!url) return null; @@ -15,3 +15,10 @@ export function resolveDocUrl(url?: KnownUrl): string | null { return null; } } + +export function getReplacementDescription( + replacement: ModuleReplacement +): string | undefined { + if (!('description' in replacement)) return undefined; + return replacement.description; +}