How to use the node-emoji.search function in node-emoji

To help you get started, we’ve selected a few node-emoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Snooful / Snooful / src / commands / emoji / emojiinfo.js View on Github external
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",
github rafaelmotta / react-native-emoji-modal-picker / src / components / EmojiModalPicker.js View on Github external
_handleOnChangeSearch = (searchText) => {
    const search = searchText.toLowerCase()

    this.setState({
      searchText, emojis: emoji.search(search)
    })
  }
github Snooful / Snooful / src / commands / emoji / emojis.js View on Github external
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",
});
github rafaelmotta / react-native-emoji-modal-picker / src / components / EmojiModalPicker.js View on Github external
/**
     * 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'
github egodigital / vscode-powertools / src / tools / quickcode.ts View on Github external
(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;
        }
    );