microdata-tooling
Version:
Provides tooling to help using micro data from TypeScript/JavaScript.
24 lines (23 loc) • 617 B
TypeScript
export interface MicroJson {
items: MicroJsonThing[];
}
export interface MicroJsonThing {
type?: string[];
id?: string;
properties: {
[k: string]: (MicroJsonThing | string)[];
};
}
/**
* Read micro data from a HTML element tree as specified in the standard.
*
* @remarks
*
* Unlike with the spec, the returned value is an object model, not a JSON string.
*
* @param nodes - The elements to extract from.
* @returns Extracted micro data.
*
* @see {@link https://html.spec.whatwg.org/multipage/microdata.html#json}
*/
export declare function jsonify(nodes: Element[]): MicroJson;