mirror of
https://github.com/Mintplex-Labs/vector-admin.git
synced 2026-08-27 20:30:05 -04:00
0a5d2039ea
move fuzzy match to util
12 lines
323 B
JavaScript
12 lines
323 B
JavaScript
// Dirty, but works fast for most cases. Wont be perfect but also not something we should rely
|
|
// heavily on for exact text searching.
|
|
function fuzzyMatch(pattern, str) {
|
|
pattern = ".*" + pattern.split("").join(".*") + ".*";
|
|
const re = new RegExp(pattern);
|
|
return re.test(str);
|
|
}
|
|
|
|
module.exports = {
|
|
fuzzyMatch,
|
|
};
|