Use a regex because it's simpler and works

and my loop did not because I meant 'or', not 'and'
pull/21833/head
David Baker 2020-01-07 19:57:17 +00:00
parent f31cc7dfee
commit bd336b0710
1 changed files with 1 additions and 9 deletions

View File

@ -87,13 +87,5 @@ EMOJIBASE.forEach(emoji => {
* @returns {string} stripped string * @returns {string} stripped string
*/ */
function stripVariation(str) { function stripVariation(str) {
let ret = ''; return str.replace("\uFE00-\uFE0F", "");
for (let i = 0; i < str.length; ++i) {
const charCode = str.charCodeAt(i);
// append to output only if it's outside the variation selector range
if (charCode < 0xFE00 && charCode > 0xFE0F) {
ret += str.charAt(i);
}
}
return ret;
} }