File: demo.js

package info (click to toggle)
node-regexpu-core 4.5.4+ds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 160 kB
  • sloc: makefile: 8; sh: 2
file content (18 lines) | stat: -rw-r--r-- 488 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"use strict";

const rewritePattern = require("./rewrite-pattern");
const parse = require('regjsparser').parse;
const generate = require('regjsgen').generate;
const regenerate = require('regenerate');

const pattern = String.raw`-`;

console.log(generate(parse(pattern)));
console.log(regenerate("-".codePointAt(0)).toString())

const processedPattern = rewritePattern(pattern, 'u', { useUnicodeFlag: true });

console.log(processedPattern);

// throws
new RegExp(processedPattern, 'u');