Back

0% Statements 0/2
0% Branches 0/2
0% Functions 0/1
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                                                                     
/**
 * Internal dependencies
 */
import { authorAdapter } from './author';
import { postAdapter } from './post';
import { videoAdapter } from './video';
import type { SingleReportAdapter } from './adapter';
 
// The adapters by record `path`; a record without one renders from the record alone.
const ADAPTERS: Record< string, SingleReportAdapter > = {
	author: authorAdapter,
	post: postAdapter,
	video: videoAdapter,
};
 
/**
 * The adapter of a registered page, if the route ships one.
 *
 * @param path - The record's `path`.
 * @return The adapter, or undefined.
 */
export function getSingleReportAdapter( path: string ): SingleReportAdapter | undefined {
	return Object.prototype.hasOwnProperty.call( ADAPTERS, path ) ? ADAPTERS[ path ] : undefined;
}
 
export type {
	EntitySummary,
	HeaderContext,
	SectionScope,
	SectionState,
	SectionsContext,
	SingleReportAdapter,
	SingleReportHeaderSlots,
} from './adapter';