Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handler: args => {
const key = getEmojiKey(args.emoji);
const emoji = emojiAPI.find(key);
if (emoji && emoji.emoji && emoji.key) {
args.send(args.localize("emoji_info", emoji.emoji, emoji.key.replace(/_/g, " ")));
} else {
// Search for names
const search = emojiAPI.search(key);
if (search[0] && search[0].emoji && search[0].key) {
args.send(args.localize("emoji_info_closest", search[0].emoji, search[0].key.replace(/_/g, " ")));
} else {
args.send(args.localize("emoji_not_found"));
}
}
},
name: "emojiinfo",
_handleOnChangeSearch = (searchText) => {
const search = searchText.toLowerCase()
this.setState({
searchText, emojis: emoji.search(search)
})
}
const paginate = require("./../../utils/paginate.js");
const emojiAPI = require("node-emoji");
const emojiList = emojiAPI.search("");
module.exports = paginate("emojis", () => {
return emojiList.map(emoji => {
return `${emoji.emoji} (${emoji.key.replace(/_/g, " ")})`;
});
}, {
command: {
category: "emoji",
description: "Gives a list of emojis.",
},
dataType: "emoji_datatype",
});
/**
* Modal onRequestClose callback
*/
onRequestClose: PropTypes.func
}
static defaultProps = {
show: false,
searchBarPlaceholder: 'Type to search',
noResultsText: 'No results for',
noResultsEmoji: 'see_no_evil'
}
state = {
searchText: '',
emojis: emoji.search('')
}
componentDidUpdate (prevProps, prevState) {
if (prevProps.show !== this.props.show) {
const timeout = this.props.show ? 0 : 250
setTimeout(() => {
StatusBar.setHidden(this.props.show, this.animationType)
}, timeout)
this._handleOnChangeSearch('')
}
}
get animationType () {
return Platform.OS === 'ios' ? 'slide' : 'fade'
(search) => {
const emoji = require('node-emoji');
search = $h.toStringSafe(search).trim();
const SEARCH_RESULT = emoji.search(search);
const EMOJI_LIST = {};
for (const ITEM of SEARCH_RESULT) {
EMOJI_LIST[ITEM.key] = ITEM.emoji;
}
const SORTED_EMOJI_LIST = {};
for (const KEY of Object.keys(EMOJI_LIST)) {
SORTED_EMOJI_LIST[KEY] = EMOJI_LIST[KEY];
}
return SORTED_EMOJI_LIST;
}
);