Recognize half width characters

This commit is contained in:
Antonio Scandurra
2015-10-15 18:57:11 +02:00
parent abf306943a
commit 1fc9a25b5c
2 changed files with 13 additions and 1 deletions

View File

@@ -81,6 +81,11 @@ isDoubleWidthCharacter = (character) ->
isCjkUnifiedIdeograph(charCode) or
isFullWidthForm(charCode)
isHalfWidthCharacter = (character) ->
charCode = character.charCodeAt(0)
0xFF65 <= charCode <= 0xFFDC
# Does the given string contain at least surrogate pair, variation sequence,
# or combined character?
#
@@ -94,4 +99,4 @@ hasPairedCharacter = (string) ->
index++
false
module.exports = {isPairedCharacter, hasPairedCharacter, isDoubleWidthCharacter}
module.exports = {isPairedCharacter, hasPairedCharacter, isDoubleWidthCharacter, isHalfWidthCharacter}