UNPKG

microdata-tooling

Version:

Provides tooling to help using micro data from TypeScript/JavaScript.

33 lines (32 loc) 914 B
import { Thing } from './schema-simple.js'; /** * Options for parsing micro data. */ export interface ParseOptions { /** * If true, items with more than one type are just skipped; otherwise a {@link MultiTypeError} is thrown. */ skipOnMultiType?: boolean; /** * If true, items with no type are just skipped; otherwise a {@link NoTypeError} is thrown. */ skipOnNoType?: boolean; } /** * Read micro data from an HTML element tree. * * @param element - The root of the HTML element tree. * @param options - The options for parsing the tree. * @returns The parsed micro data. * * @throws {@link NoTypeError} * * An item has no type. * * @throws {@link MultiTypeError} * * An item has more than one type. * * @see {@link https://html.spec.whatwg.org/multipage/microdata.html} */ export declare function parse(element: HTMLElement, options?: ParseOptions): Thing[];