How to use is-fullwidth-code-point - 1 common examples

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 1 year ago

Package Health Score

67 / 100
Full package analysis

Popular is-fullwidth-code-point functions