Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ydarissep authored Aug 25, 2024
1 parent 97b61bf commit 19a98be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utility.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
function sanitizeString(string){
function sanitizeString(string, removeSpecial = true){
const regex = /^SPECIES_|^TYPE_|^ABILITY_|^MOVE_TARGET_|^MOVE_|^SPLIT_|FLAG_|^EFFECT_|^Z_EFFECT_|^ITEM_|^EGG_GROUP_|^EVO_|^NATURE_|^POCKET_/ig

const unsanitizedString = string.toString().replace(regex, "").replaceAll(/_+/g, "_").normalize("NFD").replace(/[\u0300-\u036f]/g, "")
let unsanitizedString = string.toString().replace(regex, "").replaceAll(/_+/g, "_").normalize("NFD").replace(/[\u0300-\u036f]/g, "")
if(removeSpecial){
unsanitizedString = unsanitizedString.replace(/[\u0300-\u036f]/g, "")
}
let matchArray = unsanitizedString.match(/\w+/g)
if(matchArray){
for (i = 0; i < matchArray.length; i++){
Expand Down

0 comments on commit 19a98be

Please sign in to comment.