mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #22090 from styu/update-node-emoji
Update node-emoji types to support node-emoji v1.8.1
This commit is contained in:
Vendored
+15
-3
@@ -1,6 +1,7 @@
|
||||
// Type definitions for node-emoji 1.4
|
||||
// Type definitions for node-emoji 1.8
|
||||
// Project: https://github.com/omnidan/node-emoji#readme
|
||||
// Definitions by: Tristan Jones <https://github.com/jonestristand>
|
||||
// styu <https://github.com/styu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const emoji: {
|
||||
@@ -1347,7 +1348,18 @@ export const emoji: {
|
||||
zzz: string;
|
||||
};
|
||||
|
||||
export function emojify(str: string, on_missing?: (emoji_name: string) => string): string;
|
||||
export interface Emoji {
|
||||
emoji: string;
|
||||
key: string;
|
||||
}
|
||||
|
||||
export function emojify(str: string, on_missing?: (emoji_name: string) => string, format?: (code: string, name: string) => string): string;
|
||||
export function get(emoji: string): string;
|
||||
export function random(): string;
|
||||
export function random(): Emoji;
|
||||
export function search(searchTerm: string): Emoji[];
|
||||
export function which(emoji_code: string): string;
|
||||
export function unemojify(str: string): string;
|
||||
export function find(emoji: string): Emoji;
|
||||
export function hasEmoji(str: string): boolean;
|
||||
export function strip(str: string): string;
|
||||
export function replace(str: string, callback: (emoji: Emoji) => string): string;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import emoji = require('node-emoji');
|
||||
|
||||
const coffee: string = emoji.get('coffee');
|
||||
const result: string = emoji.random();
|
||||
const result = emoji.random();
|
||||
const result_emoji: string = result.emoji;
|
||||
|
||||
const cofee_name: string = emoji.which('☕️');
|
||||
|
||||
@@ -10,3 +11,17 @@ const emoji_string: string = emoji.emojify('I :heart: :coffee:! - :hushed::sta
|
||||
const emoji_string2: string = emoji.emojify('I :unknown_emoji: :star: :another_one:', (name: string) => name);
|
||||
|
||||
const emoji_direct: string = emoji.emoji.coffee;
|
||||
|
||||
const emoji_search = emoji.search('cof');
|
||||
const emojis_from_search: string[] = emoji_search.map(emoji => emoji.emoji);
|
||||
|
||||
const unemojified_string: string = emoji.unemojify('I ❤️ 🍕');
|
||||
|
||||
const found_emoji = emoji.find('🍕');
|
||||
const found_emoji_string: string = found_emoji.emoji;
|
||||
|
||||
const hasEmoji: boolean = emoji.hasEmoji('🍕');
|
||||
|
||||
const stripped_emoji: string = emoji.strip('⚠️ 〰️ 〰️ low disk space');
|
||||
|
||||
const replaced_emoji: string = emoji.replace('⚠️ 〰️ 〰️ low disk space', (emoji) => `${emoji.key}:`);
|
||||
|
||||
Reference in New Issue
Block a user