import type { AnyNode, Element } from 'domhandler'; import type { Cheerio } from '../cheerio.js'; import type { prop } from './attributes.js'; type ExtractDescriptorFn = (el: Element, key: string, obj: Record) => unknown; interface ExtractDescriptor { selector: string; value?: string | ExtractDescriptorFn | ExtractMap; } type ExtractValue = string | ExtractDescriptor | [string | ExtractDescriptor]; export interface ExtractMap { [key: string]: ExtractValue; } type ExtractedValue = V extends [ string | ExtractDescriptor ] ? NonNullable>[] : V extends string ? string | undefined : V extends ExtractDescriptor ? V['value'] extends ExtractMap ? ExtractedMap | undefined : V['value'] extends ExtractDescriptorFn ? ReturnType | undefined : ReturnType | undefined : never; export type ExtractedMap = { [key in keyof M]: ExtractedValue; }; /** * Extract multiple values from a document, and store them in an object. * * @param map - An object containing key-value pairs. The keys are the names of * the properties to be created on the object, and the values are the * selectors to be used to extract the values. * @returns An object containing the extracted values. */ export declare function extract(this: Cheerio, map: M): ExtractedMap; export {}; //# sourceMappingURL=extract.d.ts.map