Skip to content
tsdotnetPublic

About

A set of functions for testing character codes.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

@tsdotnet/char: Classify characters. Letters, digits and white space.

npm version GitHub license

Character tests on char codes: digit, letter, letter-or-digit and white space (isDigit also takes a string).

Install

npm install @tsdotnet/char

Usage

import { isDigit, isLetter, isWhiteSpace } from '@tsdotnet/char';

isDigit('7');                    // true
isDigit('a7', 1);                // true: checks the char at index 1
isLetter('q'.charCodeAt(0));     // true
isWhiteSpace(32);                 // true

isLetter, isLetterOrDigit and isWhiteSpace take a char code.

Use it from

ESM (import { isDigit, isLetter, isWhiteSpace } from '@tsdotnet/char';) or CommonJS (const { isDigit, isLetter, isWhiteSpace } = require('@tsdotnet/char');).

In a browser, without a bundler
<script src="https://cdn.jsdelivr.net/npm/@tsdotnet/char@1/dist/umd/char.min.js"></script>
<script>
  const { isDigit, isLetter, isWhiteSpace } = tsdotnet.char;
</script>

Docs

tsdotnet.github.io/char

About

A set of functions for testing character codes.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages