@xcrap/factory
Version:
Xcrap Factory is a set of utilities for dynamically creating instances of clients, extractors, and parsing models, making it easier to configure and extend scraping and parsing pipelines.
19 lines (18 loc) • 770 B
TypeScript
import { ExtractorFunction } from "@xcrap/parser";
export type CreateExtractorConfig = {
allowedExtractors: Record<string, Function>;
argumentSeparator?: string;
};
type GetExtractorOptions = {
extractorKey: string;
extractorArguments?: any[];
allowedExtractors: Record<string, Function>;
};
export type CreateExtractorOptions = {
extractorText: string;
config: CreateExtractorConfig;
};
export declare const extractorArgumentSeparator = ":";
export declare function getExtractor({ allowedExtractors, extractorArguments, extractorKey }: GetExtractorOptions): any;
declare function createExtractor({ extractorText, config: { allowedExtractors, argumentSeparator } }: CreateExtractorOptions): ExtractorFunction;
export default createExtractor;