import type { Attribution, Chapter, ShapeInput, ShapeRenderer } from "#types/chapter.types"; const differs = function differs(first: Chapter, second: Chapter | undefined): boolean { return first.body !== second?.body || first.file !== second.file; }; export const unstableChapters = function unstableChapters( render: ShapeRenderer, input: ShapeInput, attribution: Attribution, ): string[] { const first = render(input, attribution); const second = render(input, attribution); return first.filter((chapter, index) => differs(chapter, second[index])).map((chapter) => chapter.file); };