index.d.mts 958 B

1234567891011121314151617181920212223242526272829303132333435
  1. import * as js_tokens from 'js-tokens';
  2. import { Token } from 'js-tokens';
  3. interface StripLiteralOptions {
  4. /**
  5. * Will be called for each string literal. Return false to skip stripping.
  6. */
  7. filter?: (s: string) => boolean;
  8. /**
  9. * Fill the stripped literal with this character.
  10. * It must be a single character.
  11. *
  12. * @default ' '
  13. */
  14. fillChar?: string;
  15. }
  16. declare function stripLiteralJsTokens(code: string, options?: StripLiteralOptions): {
  17. result: string;
  18. tokens: Token[];
  19. };
  20. /**
  21. * Strip literal from code.
  22. */
  23. declare function stripLiteral(code: string, options?: StripLiteralOptions): string;
  24. /**
  25. * Strip literal from code, return more detailed information.
  26. */
  27. declare function stripLiteralDetailed(code: string, options?: StripLiteralOptions): {
  28. result: string;
  29. tokens: js_tokens.Token[];
  30. };
  31. export { type StripLiteralOptions, stripLiteral, stripLiteralDetailed, stripLiteralJsTokens };