How to use astral-regex - 1 common examples

To help you get started, we’ve selected a few astral-regex 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) {

astral-regex

Regular expression for matching astral symbols

MIT
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis

Popular astral-regex functions