forked from swc-project/swc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for vercel/next.js#36127 (comment)
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
crates/swc_ecma_minifier/tests/compress/fixture/next/36127/2/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Create a code check from a regex. | ||
* | ||
* @param {RegExp} regex | ||
* @returns {(code: Code) => code is number} | ||
*/ | ||
function regexCheck(regex) { | ||
return check | ||
|
||
/** | ||
* Check whether a code matches the bound regex. | ||
* | ||
* @param {Code} code Character code | ||
* @returns {code is number} Whether the character code matches the bound regex | ||
*/ | ||
function check(code) { | ||
return code !== null && regex.test(String.fromCharCode(code)) | ||
} | ||
} |