A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/discordjs/discord.js/commit/4906aaea4c0e6e868fa658d3359026eb662fbcb8 below:

Remove regular expression validation (#10996) · discordjs/discord.js@4906aae · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+3

-6

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+3

-6

lines changed Original file line number Diff line number Diff line change

@@ -16,8 +16,8 @@ describe('Context Menu Commands', () => {

16 16

// Too short of a name

17 17

expect(() => ContextMenuCommandAssertions.validateName('')).toThrowError();

18 18 19 -

// Invalid characters used

20 -

expect(() => ContextMenuCommandAssertions.validateName('ABC123$%^&')).toThrowError();

19 +

// This should be fine, even with trailing and leading spaces (API trims it).

20 +

expect(() => ContextMenuCommandAssertions.validateName(' 🩵 ABC 123 $%^& ')).not.toThrowError();

21 21 22 22

// Too long of a name

23 23

expect(() =>

@@ -60,8 +60,6 @@ describe('Context Menu Commands', () => {

60 60

});

61 61 62 62

test('GIVEN invalid name THEN throw error', () => {

63 -

expect(() => getBuilder().setName('$$$')).toThrowError();

64 - 65 63

expect(() => getBuilder().setName(' ')).toThrowError();

66 64

});

67 65 Original file line number Diff line number Diff line change

@@ -7,8 +7,7 @@ const namePredicate = s

7 7

.string()

8 8

.lengthGreaterThanOrEqual(1)

9 9

.lengthLessThanOrEqual(32)

10 -

// eslint-disable-next-line prefer-named-capture-group

11 -

.regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u)

10 +

.regex(/\S/)

12 11

.setValidationEnabled(isValidationEnabled);

13 12

const typePredicate = s

14 13

.union([s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message)])

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4