673aee74cbec1874c996221636787ebf972e95ce0bdf41e06ba1b4a7bee600dbbcc5a4d02fa33573a574a0fdbe0bb0178a3f59a56e9dd54fb4d3e33a8b5c8c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { F as FormatOptions } from './shared/confbox.9745c98f.js';
  2. /**
  3. * Converts a [JSON5](https://json5.org/) string into an object.
  4. *
  5. * @template T The type of the return value.
  6. * @param text The string to parse as JSON5.
  7. * @param options Parsing options.
  8. * @returns The JavaScript value converted from the JSON5 string.
  9. */
  10. declare function parseJSON5<T = unknown>(text: string, options?: JSON5ParseOptions): T;
  11. /**
  12. * Converts a JavaScript value to a [JSON5](https://json5.org/) string.
  13. *
  14. * @param value
  15. * @param options
  16. * @returns The JSON string converted from the JavaScript value.
  17. */
  18. declare function stringifyJSON5(value: any, options?: JSON5StringifyOptions): string;
  19. interface JSON5ParseOptions extends FormatOptions {
  20. /**
  21. * A function that alters the behavior of the parsing process, or an array of
  22. * String and Number objects that serve as a allowlist for selecting/filtering
  23. * the properties of the value object to be included in the resulting
  24. * JavaScript object. If this value is null or not provided, all properties of
  25. * the object are included in the resulting JavaScript object.
  26. */
  27. reviver?: (this: any, key: string, value: any) => any;
  28. }
  29. interface JSON5StringifyOptions extends FormatOptions {
  30. /**
  31. * A function that alters the behavior of the stringification process, or an
  32. * array of String and Number objects that serve as a allowlist for
  33. * selecting/filtering the properties of the value object to be included in
  34. * the JSON5 string. If this value is null or not provided, all properties
  35. * of the object are included in the resulting JSON5 string.
  36. */
  37. replacer?: ((this: any, key: string, value: any) => any) | null;
  38. /**
  39. * A String or Number object that's used to insert white space into the
  40. * output JSON5 string for readability purposes. If this is a Number, it
  41. * indicates the number of space characters to use as white space; this
  42. * number is capped at 10 (if it is greater, the value is just 10). Values
  43. * less than 1 indicate that no space should be used. If this is a String,
  44. * the string (or the first 10 characters of the string, if it's longer than
  45. * that) is used as white space. If this parameter is not provided (or is
  46. * null), no white space is used. If white space is used, trailing commas
  47. * will be used in objects and arrays.
  48. */
  49. space?: string | number | null;
  50. /**
  51. * A String representing the quote character to use when serializing
  52. * strings.
  53. */
  54. quote?: string | null;
  55. }
  56. export { type JSON5ParseOptions, type JSON5StringifyOptions, parseJSON5, stringifyJSON5 };