is-decimal

Check if a character is decimal

Usage no npm install needed!

<script type="module">
  import isDecimal from 'https://cdn.skypack.dev/is-decimal';
</script>

README

is-decimal

Build Coverage Downloads Size

Check if a character is decimal.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install is-decimal

Use

import {isDecimal} from 'is-decimal'

isDecimal('0') // => true
isDecimal('9') // => true
isDecimal('a') // => false
isDecimal('💩') // => false

API

This package exports the following identifiers: isDecimal. There is no default export.

isDecimal(character|code)

Check whether the given character code (number), or the character code at the first position (string), is decimal.

Related

License

MIT © Titus Wormer