@scurrlin/stencil 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +4 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ async function transformFile(filePath, options = {}) {
|
|
|
17
17
|
throw new Error(`Unable to read file: ${err.message}`);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
// Create
|
|
20
|
+
// Create interface for reading the file line by line
|
|
21
21
|
const rl = readline.createInterface({
|
|
22
22
|
input: fileStream,
|
|
23
23
|
crlfDelay: Infinity
|
|
@@ -44,11 +44,11 @@ async function transformFile(filePath, options = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function transformLine(line) {
|
|
47
|
-
//
|
|
47
|
+
// Regex to match sequences of letters and numbers
|
|
48
48
|
// \p{L} matches any kind of letter from any language
|
|
49
49
|
// \p{N} matches any kind of numeric character
|
|
50
|
-
//
|
|
51
|
-
//
|
|
50
|
+
// 'u' flag enables Unicode support
|
|
51
|
+
// 'g' flag enables global matching
|
|
52
52
|
return line.replace(/[\p{L}\p{N}]+/gu, (match) => {
|
|
53
53
|
return match[0]; // Retain only the first character
|
|
54
54
|
});
|