Format string to a json like template.
format2json(source: string, options?: FormatOptions): Promise<FormatResult | string>;
interface FormatOptions {
indent?: number; // Integer, Large then 0, default: 2
isExpand?: boolean; // Default: true
isStrict?: boolean; // Default: false
isEscape?: boolean; // Default: false
isUnscape?: boolean; // Default: false
keyQtMark?: "'" | "\"" | ""; // Default: "\""
valQtMark?: "'" | "\""; // Default: "\""
}
// If `{ resultOnly: true }` in option,
// Just eturn the format result string.
interface FormatResult {
result: string;
status: {
fmtType: 'info' | 'success' | 'warning' | 'danger';
fmtSign: 'ost' | 'col' | 'val' | 'end' | 'war' | 'scc' | 'err';
fmtLines: number;
message: string;
errFormat: boolean;
errIndex: number;
errExpect: string;
errNear: string;
}
}