Avoid Array.prototype.find()

release
Jakob Krigovsky 2017-06-23 11:32:26 +02:00
parent 435250f319
commit 164e9d06ed
1 changed files with 2 additions and 1 deletions

View File

@ -152,7 +152,8 @@ export default class Picker extends React.Component {
handleEmojiOver(emoji) { handleEmojiOver(emoji) {
var { preview } = this.refs var { preview } = this.refs
const emojiData = CUSTOM_CATEGORY.emojis.find(customEmoji => customEmoji.id === emoji.id) // Use Array.prototype.find() when it is more widely supported.
const emojiData = CUSTOM_CATEGORY.emojis.filter(customEmoji => customEmoji.id === emoji.id)[0]
preview.setState({ emoji: Object.assign(emoji, emojiData) }) preview.setState({ emoji: Object.assign(emoji, emojiData) })
clearTimeout(this.leaveTimeout) clearTimeout(this.leaveTimeout)
} }