From 35a992118ab62812d71db741192cbeeecf59df31 Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Tue, 18 Oct 2016 19:00:51 -0400 Subject: [PATCH] =?UTF-8?q?Use=20hasOwnProperty=20to=20detect=20if=20emoji?= =?UTF-8?q?=20exists=20Fixes=20a=20bug=20in=20Firefox=20where=20=E2=80=9Cw?= =?UTF-8?q?atch=E2=80=9D=20emoji=20would=20throw=20because=20apparently=20?= =?UTF-8?q?`=5FemojiData=20=3D=20data.emojis['watch']`=20returns=20a=20fun?= =?UTF-8?q?ction=20instead=20of=20the=20value=20of=20the=20watch=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 74e1fc4..aa7ffe7 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -36,24 +36,23 @@ function getSanitizedData() { } function getData(emoji, skin, sheetURL) { - var emojiData = {}, - _emojiData, _emoji, _id + var emojiData = {} if (typeof emoji == 'string') { - if (_emoji = data.short_names[emoji]) { - emoji = _emoji + if (data.short_names.hasOwnProperty(emoji)) { + emoji = data.short_names[emoji] } - if (_emojiData = data.emojis[emoji]) { - emojiData = _emojiData + if (data.emojis.hasOwnProperty(emoji)) { + emojiData = data.emojis[emoji] } } else if (emoji.id) { - if (_id = data.short_names[emoji.id]) { - emoji.id = _id + if (data.short_names.hasOwnProperty(emoji.id)) { + emoji.id = data.short_names[emoji.id] } - if (_emojiData = data.emojis[emoji.id]) { - emojiData = _emojiData + if (data.emojis.hasOwnProperty(emoji.id)) { + emojiData = data.emojis[emoji.id] skin || (skin = emoji.skin) } }