(item: CheerioAPI | string, additionalProperties?: OpenGraphProperty[])
| 398 | export function parseOpenGraph(raw: string, additionalProperties?: OpenGraphProperty[]): Dictionary<OpenGraphResult>; |
| 399 | export function parseOpenGraph($: CheerioAPI, additionalProperties?: OpenGraphProperty[]): Dictionary<OpenGraphResult>; |
| 400 | export function parseOpenGraph(item: CheerioAPI | string, additionalProperties?: OpenGraphProperty[]) { |
| 401 | const $ = typeof item === 'string' ? load(item) : item; |
| 402 | |
| 403 | return [...(additionalProperties || []), ...OPEN_GRAPH_PROPERTIES].reduce( |
| 404 | (acc, curr) => { |
| 405 | return { |
| 406 | ...acc, |
| 407 | ...optionalSpread(curr.outputName, parseOpenGraphProperty(curr, $)), |
| 408 | }; |
| 409 | }, |
| 410 | {} as Dictionary<OpenGraphResult>, |
| 411 | ); |
| 412 | } |
no test coverage detected
searching dependent graphs…