index.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. interface PrettyPrintOptions {
  2. /**
  3. * Preferred indentation.
  4. *
  5. * @default '\t'
  6. */
  7. indent?: string;
  8. /**
  9. * Set to false to get double-quoted strings.
  10. *
  11. * @default true
  12. */
  13. singleQuotes?: boolean;
  14. /**
  15. * Whether to include the property prop of the object obj in the output.
  16. *
  17. * @param obj
  18. * @param prop
  19. */
  20. filter?: (obj: any, prop: string | symbol | number) => boolean;
  21. /**
  22. * Expected to return a string that transforms the string that resulted from stringifying obj[prop].
  23. * This can be used to detect special types of objects that need to be stringified in a particular way.
  24. * The transform function might return an alternate string in this case, otherwise returning the originalResult.
  25. *
  26. * @param obj
  27. * @param prop
  28. * @param originalResult
  29. */
  30. transform?: (obj: any, prop: string | symbol | number, originalResult: string) => string;
  31. /**
  32. * When set, will inline values up to inlineCharacterLimit length for the sake of more terse output.
  33. */
  34. inlineCharacterLimit?: number;
  35. }
  36. export declare function prettyPrint(input: any): string;
  37. export declare function prettyPrint(input: any, options: PrettyPrintOptions): string;
  38. export declare function prettyPrint(input: any, options: PrettyPrintOptions, pad: string): string;
  39. export {};