Skip to content

Commit

Permalink
fix regex issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkIntaqt committed Mar 21, 2024
1 parent b0b5717 commit 6497226
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/module/user/orderChallenges.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { checkExists } from "../../func/arrayManipulationFunctions.js"
import getChallenge from "../../func/getChallenge";
import { intToTier, tierToInt } from "../../func/tierFunctions";

function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

export function getNextLevel(current, masterOnly = false, pointsOnly = false) {
if (masterOnly === true) {
Expand All @@ -26,6 +28,9 @@ export function removeUnnecessaryChallenges(challengesArray, filters, masterOnly
challenges[challenge[0]] = challenge;
})

if (search.length > 0) {
search = escapeRegExp((' ' + search).slice(1));
}

const challengesDetailed = window.JSONPREQUEST || [];

Expand Down

0 comments on commit 6497226

Please sign in to comment.