refactor(Util.escapeMarkdown): allow separate escaping and add tests (#3241)

* wip refactor

* add escapeMarkdown tests

* italics can be done with a single underscore too

* more refined

* fix test name

* unnecessary eslint ignores

* use jest

* make eslint less annoying in this test file

* more testing

* fix lib usage

* more tests and a small fix
This commit is contained in:
bdistin
2019-07-11 15:08:40 -05:00
committed by SpaceEEC
parent f1433a2d97
commit 00c4098bb3
5 changed files with 340 additions and 8 deletions

10
typings/index.d.ts vendored
View File

@@ -1160,7 +1160,15 @@ declare module 'discord.js' {
public static convertToBuffer(ab: ArrayBuffer | string): Buffer;
public static delayFor(ms: number): Promise<void>;
public static discordSort<K, V extends { rawPosition: number; id: string; }>(collection: Collection<K, V>): Collection<K, V>;
public static escapeMarkdown(text: string, onlyCodeBlock?: boolean, onlyInlineCode?: boolean): string;
public static escapeMarkdown(text: string, options?: { codeBlock?: boolean, inlineCode?: boolean, bold?: boolean, italic?: boolean, underline?: boolean, strikethrough?: boolean, spoiler?: boolean, inlineCodeContent?: boolean, codeBlockContent?: boolean }): string;
public static escapeCodeBlock(text: string): string;
public static escapeInlineCode(text: string): string;
public static escapeBold(text: string): string;
public static escapeItalic(text: string): string;
public static escapeUnderline(text: string): string;
public static escapeStrikethrough(text: string): string;
public static escapeSpoiler(text: string): string;
public static cleanCodeBlockContent(text: string): string;
public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise<number>;
public static flatten(obj: object, ...props: { [key: string]: boolean | string }[]): object;
public static idToBinary(num: Snowflake): string;