forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracker-validation-rules.ts
More file actions
36 lines (32 loc) · 881 Bytes
/
Copy pathtracker-validation-rules.ts
File metadata and controls
36 lines (32 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// src/data/tracker-validation-rules.ts
//
// Shared constants for tracker registry validation.
// Used by both the CI script and the test suite.
export const SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/
export const LOGO_NAME_RE = /^\/tracker-logos\/[a-z0-9_]+_logo\.(svg|png)$/
export const PLACEHOLDER_RE = /^TODO$/i
export const VALID_CONTENT_CATEGORIES = new Set([
"Movies",
"TV",
"Music",
"Games",
"Apps",
"Sports",
"Books",
"Audiobooks",
"Comics",
"Manga",
"Anime",
"XXX",
"Documentaries",
"Education",
"Tutorials",
"Fanres",
])
export function isEmpty(val: unknown): boolean {
if (val === null || val === undefined) return true
if (typeof val === "string" && val.trim() === "") return true
if (Array.isArray(val) && val.length === 0) return true
return false
}
export { normalizeUrl as normalizeTrackerUrl } from "@/lib/data-transforms"