@xcrap/parser
Version:
Xcrap Parser is a package of the Xcrap framework, it was developed to take care of the data extraction part of text files (currently supporting only HTML and JSON) using declarative models.
19 lines (18 loc) • 672 B
TypeScript
import { ParsingModel } from "../parsing-model-interface";
export type JsonParsingModelShapeValue = {
query: string;
default?: any;
model?: ParsingModel;
multiple?: boolean;
limit?: number;
};
export type JsonParsingModelShape = {
[key: string]: JsonParsingModelShapeValue;
};
export declare class JsonParsingModel implements ParsingModel {
readonly shape: JsonParsingModelShape;
constructor(shape: JsonParsingModelShape);
parse(source: string): Promise<Record<string | number, any>>;
parseValue(value: JsonParsingModelShapeValue, root: any): any;
parseNestedValue(value: JsonParsingModelShapeValue, root: any): Promise<any>;
}