Skip to content

Commit 5da8b4a

Browse files
fix(validator): πŸ› fix isUUIDv4() regex to include lowercase letters. … (#424)
* fix(validator): πŸ› fix isUUIDv4() regex to include lowercase letters. lines 302-303 * refactor(validator): ♻️ convert uuid to uppercase before regex test * docs(readme): πŸ“ add `@brandon-mason` to contributors --------- Co-authored-by: James <james@jamesnzl.xyz>
1 parent 7bea8c1 commit 5da8b4a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ This project uses [`gulp`](https://gulpjs.com/) and [`esbuild`](https://esbuild.
423423

424424
1. Thank you to [@PolarWolf314](https://github.com/PolarWolf314) for doing the conversion work to add Safari support!
425425
2. Thank you to [@MatthewLamperski](https://github.com/MatthewLamperski) for [#89](https://github.com/JamesNZL/notion-assignment-import/pull/89)!
426+
3. Thank you to [@brandon-mason](https://github.com/brandon-mason) for [#424](https://github.com/JamesNZL/notion-assignment-import/pull/424)!
426427

427428
# Privacy Policy
428429

β€Žsrc/options/validator.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ export const typeGuards = <const>{
302302
const hyphenatedRegex = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
303303
const nonHyphenatedRegex = /^[0-9A-F]{8}[0-9A-F]{4}4[0-9A-F]{3}[89AB][0-9A-F]{3}[0-9A-F]{12}$/i;
304304

305-
return (typeof value === 'string') && [hyphenatedRegex, nonHyphenatedRegex].some(regex => regex.test(value));
305+
return (typeof value === 'string') && [hyphenatedRegex, nonHyphenatedRegex].some(regex => regex.test(value.toUpperCase()));
306306
},
307307
};
308308

@@ -322,7 +322,7 @@ export class TimeZoneField extends InputFieldValidator {
322322
public constructor(elementId: string) {
323323
super(elementId, typeGuardModifiers.isNullable(typeGuards.isTimeZoneRequest), 'a timezone');
324324
}
325-
325+
326326
protected override async validator(inputValue: NullIfEmpty<string>): Promise<NullIfEmpty<string> | typeof InputFieldValidator.INVALID_INPUT> {
327327
if (await super.validator(inputValue) !== inputValue) {
328328
this.addInvalidError('Invalid time zone.');

0 commit comments

Comments
Β (0)