index.d.ts 772 B

1234567891011121314151617181920
  1. /**
  2. * Normalize an identifier (as found in references, definitions).
  3. *
  4. * Collapses markdown whitespace, trim, and then lower- and uppercase.
  5. *
  6. * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their
  7. * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different
  8. * uppercase character (U+0398 (`Θ`)).
  9. * So, to get a canonical form, we perform both lower- and uppercase.
  10. *
  11. * Using uppercase last makes sure keys will never interact with default
  12. * prototypal values (such as `constructor`): nothing in the prototype of
  13. * `Object` is uppercase.
  14. *
  15. * @param {string} value
  16. * Identifier to normalize.
  17. * @returns {string}
  18. * Normalized identifier.
  19. */
  20. export function normalizeIdentifier(value: string): string