index.js 374 B

12345678910111213
  1. /**
  2. * Check if the given character code, or the character code at the first
  3. * character, is decimal.
  4. *
  5. * @param {string|number} character
  6. * @returns {boolean} Whether `character` is a decimal
  7. */
  8. export function isDecimal(character) {
  9. const code =
  10. typeof character === 'string' ? character.charCodeAt(0) : character
  11. return code >= 48 && code <= 57 /* 0-9 */
  12. }