Simplify regular expressions

This commit is contained in:
absidue
2021-12-26 16:55:10 +01:00
parent 6c607f062f
commit 770e896cc0
4 changed files with 7 additions and 7 deletions

View File

@@ -92,7 +92,7 @@ async function internalValidate(url: string): Promise<TypeData> {
return { type: false };
}
if ((path[1] === 'track' || path[1] === 'album' || path[1] === 'playlist') && path[2].match(/^[0-9]+$/)) {
if ((path[1] === 'track' || path[1] === 'album' || path[1] === 'playlist') && path[2].match(/^\d+$/)) {
return {
type: path[1],
id: path[2]
@@ -105,7 +105,7 @@ async function internalValidate(url: string): Promise<TypeData> {
if (
path.length === 3 &&
(path[1] === 'track' || path[1] === 'album' || path[1] === 'playlist') &&
path[2].match(/^[0-9]+$/)
path[2].match(/^\d+$/)
) {
return {
type: path[1],