Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jridgewell/is-whitespace-code-point
Checks if a given code point is whitespace
https://github.com/jridgewell/is-whitespace-code-point
Last synced: about 2 months ago
JSON representation
Checks if a given code point is whitespace
- Host: GitHub
- URL: https://github.com/jridgewell/is-whitespace-code-point
- Owner: jridgewell
- License: mit
- Created: 2018-05-13T04:23:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-13T08:12:42.000Z (over 6 years ago)
- Last Synced: 2024-10-19T18:31:11.966Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# is-whitespace-code-point [![Build Status][travis-badge]][travis]
Checks if a given code point (ie, the return value from
[String.p.charCodeAt][charCodeAt]) is whitespace. Semantically
equivalent to `/\s/`, but considerably faster.## Installation
```bash
npm install is-whitespace-code-point
```## Usage
```javascript
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) // => trueisWhitespace('a'.charCodeAt(0)) // => false
isWhitespace(0x61) // => false
isWhitespace(97) // => false
```## License
MIT
[travis-badge]: https://img.shields.io/travis/jridgewell/is-whitespace-code-point.svg
[travis]: https://travis-ci.org/jridgewell/is-whitespace-code-point
[charCodeAt]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt