"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/is-fullwidth-code-point/index.js" (11 Apr 2017, 1463 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 'use strict';
    2 var numberIsNan = require('number-is-nan');
    3 
    4 module.exports = function (x) {
    5     if (numberIsNan(x)) {
    6         return false;
    7     }
    8 
    9     // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
   10 
   11     // code points are derived from:
   12     // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
   13     if (x >= 0x1100 && (
   14         x <= 0x115f ||  // Hangul Jamo
   15         0x2329 === x || // LEFT-POINTING ANGLE BRACKET
   16         0x232a === x || // RIGHT-POINTING ANGLE BRACKET
   17         // CJK Radicals Supplement .. Enclosed CJK Letters and Months
   18         (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
   19         // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
   20         0x3250 <= x && x <= 0x4dbf ||
   21         // CJK Unified Ideographs .. Yi Radicals
   22         0x4e00 <= x && x <= 0xa4c6 ||
   23         // Hangul Jamo Extended-A
   24         0xa960 <= x && x <= 0xa97c ||
   25         // Hangul Syllables
   26         0xac00 <= x && x <= 0xd7a3 ||
   27         // CJK Compatibility Ideographs
   28         0xf900 <= x && x <= 0xfaff ||
   29         // Vertical Forms
   30         0xfe10 <= x && x <= 0xfe19 ||
   31         // CJK Compatibility Forms .. Small Form Variants
   32         0xfe30 <= x && x <= 0xfe6b ||
   33         // Halfwidth and Fullwidth Forms
   34         0xff01 <= x && x <= 0xff60 ||
   35         0xffe0 <= x && x <= 0xffe6 ||
   36         // Kana Supplement
   37         0x1b000 <= x && x <= 0x1b001 ||
   38         // Enclosed Ideographic Supplement
   39         0x1f200 <= x && x <= 0x1f251 ||
   40         // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
   41         0x20000 <= x && x <= 0x3fffd)) {
   42         return true;
   43     }
   44 
   45     return false;
   46 }