This file contains hidden or 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
import fs from 'node:fs'; | |
import path from 'node:path'; | |
function readdirSyncDeep(dir: string, rootDir: string = dir) { | |
const files = fs.readdirSync(dir); | |
const filelist: string[] = []; | |
files.forEach((file) => { | |
const filePath = path.join(dir, file); |
This file contains hidden or 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
function highlightPattern(text, pattern) { | |
const splitText = text.split(pattern); | |
if (splitText.length <= 1) { | |
return text; | |
} | |
const matches = text.match(pattern); | |
return splitText.reduce((arr, element, index) => (matches[index] ? [ |
NewerOlder