@sigiljs/sigil
Version:
TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating
13 lines (12 loc) • 641 B
TypeScript
interface CommonOptions {
fallback?: string;
throw?: boolean;
}
interface StringifyOptions extends CommonOptions {
replacer?: (this: any, key: string, value: any) => any;
space?: string | number;
}
type FnResponse<K extends CommonOptions> = K extends string ? string : (K["fallback"] extends string ? string : (K["throw"] extends true ? string : string | null));
export declare function jsonStringify<K extends StringifyOptions>(payload: any, options?: K): FnResponse<K>;
export declare function jsonParse<T = any, E extends boolean = boolean>(payload: string, throwExceptions?: E): E extends true ? T : T | null;
export {};