UNPKG

sucrase

Version:

Super-fast alternative to Babel for when you can target modern JS runtimes

20 lines (17 loc) 689 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isNewLine = isNewLine; exports.nonASCIIwhitespace = exports.lineBreakG = exports.lineBreak = void 0; // Matches a whole line break (where CRLF is considered a single // line break). Used to count lines. const lineBreak = /\r\n?|\n|\u2028|\u2029/; exports.lineBreak = lineBreak; const lineBreakG = new RegExp(lineBreak.source, "g"); exports.lineBreakG = lineBreakG; function isNewLine(code) { return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; } const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; exports.nonASCIIwhitespace = nonASCIIwhitespace;