UNPKG

typescript-scaffolder

Version:

![npm version](https://img.shields.io/npm/v/typescript-scaffolder) ![coverage](https://img.shields.io/badge/coverage-97.38%25-green)

33 lines 1.5 kB
export declare const prefixDelimiter = "__PREFIX__"; /** * Converts a filename (e.g. user-profile.json or order_log.json) * into a PascalCase TypeScript interface name (e.g. UserProfile, OrderLog). * @param filePath */ export declare function deriveObjectName(filePath: string): string; /** * Takes in a stringified value and infers the primitive type * @param value */ export declare function inferPrimitiveType(value: string): 'string' | 'number' | 'boolean'; /** * scans a json object and identifies all duplicate keys for preprocessing * @param input */ export declare function findGloballyDuplicatedKeys(input: any): Set<string>; /** * A preprocessor for Quicktype to prefix duplicate keys so that it does not create circular references * or bad interfaces. Will prefix all duplicate keys with the field name of the parent. The prefix is then * removed later downstream. * @param input * @param duplicateKeys * @param prefixedKeys Optional set to collect the actual prefixed keys during processing. */ export declare function prefixDuplicateKeys(input: any, duplicateKeys: Set<string>, prefixedKeys?: Set<string>): any; export declare function toPascalCase(str: string): string; /** * Safely unprefix keys that were actually prefixed by prefixDuplicateKeys. * Only keys present in `prefixedKeys` are unprefixed; everything else is left untouched. */ export declare function unprefixKeysSafe(obj: any, prefixedKeys: Set<string>): any; //# sourceMappingURL=object-helpers.d.ts.map