MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / removeAccents

Function removeAccents

scripts/helpers/utils.js:540–554  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

538
539// https://gist.github.com/bluzky/b8c205c98ff3318907b30c3e0da4bf3f
540export function removeAccents(str) {
541 let from =
542 "àáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîöüûñçýỳỹỵỷ",
543 to =
544 "aaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiouuncyyyyy";
545 for (let i = 0, l = from.length; i < l; i++) {
546 str = str.replace(RegExp(from[i], "gi"), to[i]);
547 }
548
549 str = str.toLowerCase().trim();
550 // .replace(/[^a-z0-9\-]/g, "-")
551 // .replace(/-+/g, "-");
552
553 return str;
554}
555
556export const isFunction = (o) => typeof o === "function";
557

Callers 1

initSearchFunction · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected