MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getUnreleasedSection

Function getUnreleasedSection

scripts/generate-changelog.ts:26–44  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

24}
25
26function getUnreleasedSection(content: string): string[] {
27 const lines = content.split('\n');
28
29 const unreleasedIndex = lines.findIndex(line => line.trim() === '## Unreleased');
30 if (unreleasedIndex === -1) {
31 // eslint-disable-next-line no-console
32 console.error('Could not find "## Unreleased" section in CHANGELOG.md');
33 process.exit(1);
34 }
35
36 const nextVersionIndex = lines.findIndex((line, index) => index > unreleasedIndex && /^## \d+\.\d+\.\d+/.test(line));
37 if (nextVersionIndex === -1) {
38 // eslint-disable-next-line no-console
39 console.error('Could not find next version section after "## Unreleased"');
40 process.exit(1);
41 }
42
43 return lines.slice(unreleasedIndex + 1, nextVersionIndex);
44}
45
46function createEntry(content: string, type: EntryType): ChangelogEntry {
47 const firstLine = content.split('\n')[0] ?? content;

Callers 1

runFunction · 0.85

Calls 3

sliceMethod · 0.80
errorMethod · 0.65
testMethod · 0.65

Tested by

no test coverage detected