core.d.ts 808 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Encode certain characters in `value`.
  3. *
  4. * @param {string} value
  5. * @param {CoreWithFormatOptions} options
  6. * @returns {string}
  7. */
  8. export function core(value: string, options: CoreWithFormatOptions): string;
  9. export type CoreOptions = {
  10. /**
  11. * Whether to only escape the given subset of characters.
  12. */
  13. subset?: ReadonlyArray<string>;
  14. /**
  15. * Whether to only escape possibly dangerous characters.
  16. * Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
  17. */
  18. escapeOnly?: boolean;
  19. };
  20. export type FormatOptions = {
  21. /**
  22. * Format strategy.
  23. */
  24. format: (code: number, next: number, options: CoreWithFormatOptions) => string;
  25. };
  26. export type CoreWithFormatOptions = CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions;