9ec3d94f8d1005229d7e194d7c7638f8b90dc7e3290e30cbf052d33eb548829e1850fe1e5781f1915c3a9459d9da8dd2c4f04b3b5c6ec6068ab42b4f4c5761 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. export { JSON5ParseOptions, JSON5StringifyOptions, parseJSON5, stringifyJSON5 } from './json5.mjs';
  2. export { JSONCParseError, JSONCParseOptions, parseJSONC, stringifyJSONC } from './jsonc.mjs';
  3. export { YAMLParseOptions, YAMLStringifyOptions, parseYAML, stringifyYAML } from './yaml.mjs';
  4. import { F as FormatOptions } from './shared/confbox.9745c98f.mjs';
  5. export { parseTOML, stringifyTOML } from './toml.mjs';
  6. /**
  7. * Converts a [JSON](https://www.json.org/json-en.html) string into an object.
  8. *
  9. * Indentation status is auto-detected and preserved when stringifying back using `stringifyJSON`
  10. */
  11. declare function parseJSON<T = unknown>(text: string, options?: JSONParseOptions): T;
  12. /**
  13. * Converts a JavaScript value to a [JSON](https://www.json.org/json-en.html) string.
  14. *
  15. * Indentation status is auto detected and preserved when using value from parseJSON.
  16. */
  17. declare function stringifyJSON(value: any, options?: JSONStringifyOptions): string;
  18. interface JSONParseOptions extends FormatOptions {
  19. /**
  20. * A function that transforms the results. This function is called for each member of the object.
  21. */
  22. reviver?: (this: any, key: string, value: any) => any;
  23. }
  24. interface JSONStringifyOptions extends FormatOptions {
  25. /**
  26. * A function that transforms the results. This function is called for each member of the object.
  27. */
  28. replacer?: (this: any, key: string, value: any) => any;
  29. }
  30. export { type JSONParseOptions, type JSONStringifyOptions, parseJSON, stringifyJSON };