infra.js 453 B

123456789101112131415161718192021222324
  1. "use strict";
  2. function isASCIIDigit(c) {
  3. return c >= 0x30 && c <= 0x39;
  4. }
  5. function isASCIIAlpha(c) {
  6. return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A);
  7. }
  8. function isASCIIAlphanumeric(c) {
  9. return isASCIIAlpha(c) || isASCIIDigit(c);
  10. }
  11. function isASCIIHex(c) {
  12. return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
  13. }
  14. module.exports = {
  15. isASCIIDigit,
  16. isASCIIAlpha,
  17. isASCIIAlphanumeric,
  18. isASCIIHex
  19. };