refactor: allow both http and https

This commit is contained in:
Carlos Valente
2025-01-06 19:54:34 +01:00
committed by Carlos Valente
parent d175c788c5
commit a8fe4c8e68
2 changed files with 3 additions and 3 deletions
@@ -26,8 +26,8 @@ describe('simple tests for regex', () => {
});
test('startsWithHttp', () => {
const right = ['http://test'];
const wrong = ['https://test', 'testing', '123.0.1'];
const right = ['https://test', 'http://test'];
const wrong = ['testing', '123.0.1'];
right.forEach((t) => {
expect(startsWithHttp.test(t)).toBe(true);
+1 -1
View File
@@ -5,7 +5,7 @@
export const isOnlyNumbers = /^\d+$/;
export const isIPAddress = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
export const startsWithHttp = /^http:\/\//;
export const startsWithHttp = /^https?:\/\//;
export const startsWithSlash = /^\//;
export const isAlphanumeric = /^[a-z0-9]+$/i;
export const isASCII = /^[ -~]+$/; //https://catonmat.net/my-favorite-regex