is-hexadecimal

Check if a character is hexadecimal

Usage no npm install needed!

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

README

is-hexadecimal

Build Coverage Downloads Size

Check if a character is hexadecimal.

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-hexadecimal

Use

import {isHexadecimal} from 'is-hexadecimal'

isHexadecimal('a') // => true
isHexadecimal('0') // => true
isHexadecimal('G') // => false
isHexadecimal('💩') // => false

API

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

isHexadecimal(character|code)

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

Related

License

MIT © Titus Wormer