Merge pull request #32286 from rimiti/update-node-emoji-typing

Update replace() definition from @types/node-emoji
This commit is contained in:
Daniel Rosenwasser
2019-01-22 15:57:14 -08:00
committed by GitHub
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/omnidan/node-emoji#readme
// Definitions by: Tristan Jones <https://github.com/jonestristand>
// styu <https://github.com/styu>
// rimiti <https://github.com/rimiti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const emoji: {
@@ -1362,4 +1363,4 @@ 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;
export function replace(str: string, replacement: ((emoji: Emoji) => string) | string, cleanSpaces?: boolean): string;
+4
View File
@@ -25,3 +25,7 @@ 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}:`);
const replaced_emoji_with_string: string = emoji.replace('⚠️ 〰️ 〰️ low disk space', 'example');
const replaced_emoji_keep_spaces: string = emoji.replace('⚠️ 〰️ 〰️ low disk space', '', false);