UNPKG

@nxmix/is-full-width

Version:

> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)

44 lines (25 loc) 1.21 kB
# @nxmix/is-full-width [![Build Status](https://travis-ci.org/NXMIX/is-full-width.svg?branch=master)](https://travis-ci.org/NXMIX/is-full-width) > Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) ## Why another `is-fullwidth-code-point`? Compare to [is-fullwidth-codepoint](https://github.com/sindresorhus/is-fullwidth-code-point), I'm trying to give a fully accurate implementation of official [Unicode EastAsianWidth specification v11.0](ftp://ftp.unicode.org/Public/11.0.0/ucd/EastAsianWidth.txt). The code in `src/index.ts` is generated by an internal tool that reflects the contents of the specification range by range. ## Install ``` $ npm install @nxmix/is-full-width ``` [Typescript](https://www.typescriptlang.org) definition file is already included. ## Usage ```js const isFullwidth = require('is-full-width'); isFullwidth('谢'.codePointAt()); //=> true isFullwidth('a'.codePointAt()); //=> false ``` ## API ### isFullwidth(input) #### input Type: `number` [Code point](https://en.wikipedia.org/wiki/Code_point) of a character. ## License MIT