is-whitespace-code-point

1.0.1 • Public • Published

is-whitespace-code-point Build Status

Checks if a given code point (ie, the return value from String.p.charCodeAt) is whitespace. Semantically equivalent to /\s/, but considerably faster.

Installation

npm install is-whitespace-code-point

Usage

var isWhitespace = require('is-whitespace-code-point')
 
isWhitespace(' '.charCodeAt(0)) // => true
isWhitespace(0x20) // => true
isWhitespace(32) // => true
isWhitespace('\n'.charCodeAt(0)) // => true
isWhitespace(0x0A) // => true
isWhitespace(10) // => true
 
isWhitespace('a'.charCodeAt(0)) // => false
isWhitespace(0x61) // => false
isWhitespace(97) // => false

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i is-whitespace-code-point

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.55 kB

Total Files

4

Last publish

Collaborators

  • jridgewell