UNPKG

histoire

Version:

A fast story book powered by Vite

21 lines (20 loc) • 800 B
const knownEmptyGeneratedStories = new WeakSet(); /** * Marks one trusted generated story object as having no test registrations. * @param story The generated story options object. * @returns The same object, so story identity stays unchanged. */ export function markGeneratedStoryKnownEmpty(story) { knownEmptyGeneratedStories.add(story); return story; } /** * Checks private generation metadata without adding fields to the story object. * @param story The story object captured from the generated module. * @returns Whether Histoire itself marked this exact object. */ export function isGeneratedStoryKnownEmpty(story) { if ((typeof story !== 'object' || story === null) && typeof story !== 'function') return false; return knownEmptyGeneratedStories.has(story); }