From 5861de2def93ee06914ee3d1b78f44793068c693 Mon Sep 17 00:00:00 2001 From: Dimitri DO BAIRRO Date: Fri, 18 Jan 2019 12:19:40 +0100 Subject: [PATCH 1/3] feat(types/node-emoji/index.d.ts) replace definition fixed --- types/node-emoji/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node-emoji/index.d.ts b/types/node-emoji/index.d.ts index 5f4d050fb3..ae8710d083 100644 --- a/types/node-emoji/index.d.ts +++ b/types/node-emoji/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/omnidan/node-emoji#readme // Definitions by: Tristan Jones // styu +// 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; From 007ec9e23ccfd6e285a81bf8b7bdb8274108f1a9 Mon Sep 17 00:00:00 2001 From: Dimitri DO BAIRRO Date: Sat, 19 Jan 2019 14:30:49 +0100 Subject: [PATCH 2/3] feat(types/node-emoji/index.d.ts) replace definition fixed --- types/node-emoji/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-emoji/index.d.ts b/types/node-emoji/index.d.ts index ae8710d083..f07b12372c 100644 --- a/types/node-emoji/index.d.ts +++ b/types/node-emoji/index.d.ts @@ -1363,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, replacement: (emoji: Emoji) => string | string, cleanSpaces?: boolean): string; +export function replace(str: string, replacement: ((emoji: Emoji) => string) | string, cleanSpaces?: boolean): string; From fe910f3f196702dfa63376478c18a6218d23f633 Mon Sep 17 00:00:00 2001 From: Dimitri DO BAIRRO Date: Sat, 19 Jan 2019 14:37:40 +0100 Subject: [PATCH 3/3] feat(types/node-emoji/node-emoji-tests.tf) tests added --- types/node-emoji/node-emoji-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/node-emoji/node-emoji-tests.ts b/types/node-emoji/node-emoji-tests.ts index 918cb1e1f5..11e4788936 100644 --- a/types/node-emoji/node-emoji-tests.ts +++ b/types/node-emoji/node-emoji-tests.ts @@ -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);