Use for loop and refactor lookup code
parent
90b36d829f
commit
5c64cc6908
|
@ -157,19 +157,23 @@ function getEmojiDataFromNative(nativeString, set, data) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emojiData = Object.values(data.emojis).find((emoji) => {
|
let emojiData;
|
||||||
emoji = JSON.parse(_JSON.stringify(emoji))
|
|
||||||
|
for (let id in data.emojis) {
|
||||||
|
let emoji = data.emojis[id]
|
||||||
|
|
||||||
|
let emojiUnified = emoji.unified
|
||||||
|
|
||||||
if (emoji.variations && emoji.variations.length) {
|
if (emoji.variations && emoji.variations.length) {
|
||||||
emoji.unified = emoji.variations.shift()
|
emojiUnified = emoji.variations.shift()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skin && emoji.skin_variations && emoji.skin_variations[skinCode]) {
|
if (skin && emoji.skin_variations && emoji.skin_variations[skinCode]) {
|
||||||
emoji.unified = emoji.skin_variations[skinCode].unified
|
emojiUnified = emoji.skin_variations[skinCode].unified
|
||||||
}
|
}
|
||||||
|
|
||||||
return unifiedToNative(emoji.unified) === baseNativeString
|
if (unifiedToNative(emojiUnified) === baseNativeString) emojiData = emoji
|
||||||
})
|
}
|
||||||
|
|
||||||
if (!emojiData) {
|
if (!emojiData) {
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in New Issue