3.2.0 • Published 2 years ago

emojis-search-ts v3.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

emojis-search-ts

Search emoji details by keyword & manage emoji search tags with this library that is TDD'ed, documented, & supports TypeScript.

Install

npm install emojis-search-ts

Emoji Search

Emoji details matching a given keyword are provided via the core search function.

// NodeJS: const { emojisSearch } = require('emojis-search-ts');
import { emojisSearch, IEmojiDetail } from 'emojis-search-ts';

const emojiDetails: IEmojiDetail[] = emojisSearch(':)'); // => [{ name, emoji, keywords }, ...]
const { name, emoji } = emojiDetails[0]; // => { name: 'grinning_face_with_big_eyes', emoji: '😃' }

Emoji Search Tag Utilities

This library includes several utilities to help manage emoji search tags (i.e., contains no spaces, contains at least 1 non-: characters, & is wrapped in :, e.g., :example:), which can be used to aid search interfaces & text to emoji substitutions.

import { isEmojiSearchTag, toEmojiSearchTag, fromEmojiSearchTag, replaceEmojiSearchTag, replaceAllEmojiSearchTags } from 'emojis-search-ts';

// Check for a valid emoji search tag.
isEmojiSearchTag(':example:') //=> true
containsEmojiSearchTag('a :example: b'); //=> true

// Convert to/from emoji search tags.
toEmojiSearchTag('example') //=> ':example:'
fromEmojiSearchTag(':example:') //=> 'example'
fromAllEmojiSearchTags('a :x: b :example: c test') //=> ['x', 'example']

// Replace emoji search tags.
replaceEmojiSearchTag('a :swap_this: b c', `swap_this`, 'to_this') //=> 'a :to_this: b c'
replaceAllEmojiSearchTags('a :swap_x: b :swap_y: c', { swap_x: 'to_x', swap_y: 'to_y' }) //=> 'a :to_x: b :to_y: c'
3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago