MCPcopy Create free account
hub / github.com/Effect-TS/effect / extractImportMapSections

Function extractImportMapSections

packages/tools/api-diff/src/MigrationDoc.ts:275–286  ·  view source on GitHub ↗
(document: string)

Source from the content-addressed store, hash-verified

273}
274
275export const extractImportMapSections = (document: string): string => {
276 const start = document.indexOf("## Import Map")
277 if (start === -1) {
278 return "## Import Map\n\nNo import map is available.\n"
279 }
280 const apiRenames = document.indexOf("\n## API Renames", start)
281 const removedModules = document.indexOf("\n## Removed Modules", start)
282 const apiReference = document.indexOf("\n## API Reference", start)
283 const ends = [apiRenames, removedModules, apiReference].filter((index) => index !== -1)
284 const end = ends.length === 0 ? document.length : Math.min(...ends)
285 return `${document.slice(start, end).trim()}\n`
286}
287
288export const renderMigrationDocument = (
289 diff: ApiDiff,

Callers 2

ApiDiffClass · 0.90

Calls 3

trimMethod · 0.80
sliceMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected