How to use the is-fullwidth-code-point function in is-fullwidth-code-point

To help you get started, we’ve selected a few is-fullwidth-code-point examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zamotany / react-slate / packages / react-slate-core / src / utils / sliceAnsi.js View on Github external
if (ESCAPES.indexOf(x) !== -1) {
      insideEscape = true;
      const code = /\d[^m]*/.exec(str.slice(i, str.indexOf('m', i)));
      escapeCode = code === END_CODE ? null : code;
    } else if (insideEscape && x === 'm') {
      insideEscape = false;
      leftEscape = true;
    }

    if (!insideEscape && !leftEscape) {
      ++visible;
    }

    if (
      !astralRegex({ exact: true }).test(x) &&
      isFullwidthCodePoint(x.codePointAt())
    ) {
      ++visible;
    }

    if (visible > begin && visible <= end) {
      output += x;
    } else if (
      visible === begin &&
      !insideEscape &&
      escapeCode !== undefined &&
      escapeCode !== END_CODE
    ) {
      output += wrapAnsi(escapeCode);
    } else if (visible >= end) {
      if (escapeCode !== undefined) {
        output += wrapAnsi(

is-fullwidth-code-point

Check if the character represented by a given Unicode code point is fullwidth

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis

Popular is-fullwidth-code-point functions