summaryrefslogtreecommitdiff
path: root/node_modules/is-decimal/index.js
blob: 4fe00ff75163eb55e860710283c4e601acce6870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * Check if the given character code, or the character code at the first
 * character, is decimal.
 *
 * @param {string|number} character
 * @returns {boolean} Whether `character` is a decimal
 */
export function isDecimal(character) {
  const code =
    typeof character === 'string' ? character.charCodeAt(0) : character

  return code >= 48 && code <= 57 /* 0-9 */
}