index.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Checks if the given code point can start an identifier.
  3. *
  4. * @param {number | undefined} code
  5. * Code point to check.
  6. * @returns {boolean}
  7. * Whether `code` can start an identifier.
  8. */
  9. export function start(code: number | undefined): boolean;
  10. /**
  11. * Checks if the given code point can continue an identifier.
  12. *
  13. * @param {number | undefined} code
  14. * Code point to check.
  15. * @param {Options | null | undefined} [options]
  16. * Configuration (optional).
  17. * @returns {boolean}
  18. * Whether `code` can continue an identifier.
  19. */
  20. export function cont(code: number | undefined, options?: Options | null | undefined): boolean;
  21. /**
  22. * Checks if the given value is a valid identifier name.
  23. *
  24. * @param {string} name
  25. * Identifier to check.
  26. * @param {Options | null | undefined} [options]
  27. * Configuration (optional).
  28. * @returns {boolean}
  29. * Whether `name` can be an identifier.
  30. */
  31. export function name(name: string, options?: Options | null | undefined): boolean;
  32. /**
  33. * Configuration.
  34. */
  35. export type Options = {
  36. /**
  37. * Support JSX identifiers (default: `false`).
  38. */
  39. jsx?: boolean | null | undefined;
  40. };