summary refs log tree commit diff
path: root/src/api/util/utility/String.ts
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-17 11:00:51 +0100
committerRory& <root@rory.gay>2025-12-17 11:01:27 +0100
commit491c0de845a886954262e3ddb24959ba37a014b6 (patch)
treec0251f3779a5cd2842320e1278232b48fbea0390 /src/api/util/utility/String.ts
parentPre-commit: use spaces for formatting, regenerate schemas if changed (diff)
downloadserver-ts-491c0de845a886954262e3ddb24959ba37a014b6.tar.xz
lintstagedrc: regenerate schemas/openapi if schemas changed
Diffstat (limited to 'src/api/util/utility/String.ts')
-rw-r--r--src/api/util/utility/String.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/api/util/utility/String.ts b/src/api/util/utility/String.ts

index e5c1279a..e33613a3 100644 --- a/src/api/util/utility/String.ts +++ b/src/api/util/utility/String.ts
@@ -21,18 +21,18 @@ import { ntob } from "./Base64"; import { FieldErrors, Random } from "@spacebar/util"; export function checkLength(str: string, min: number, max: number, key: string, req: Request) { - if (str.length < min || str.length > max) { - throw FieldErrors({ - [key]: { - code: "BASE_TYPE_BAD_LENGTH", - message: req.t("common:field.BASE_TYPE_BAD_LENGTH", { - length: `${min} - ${max}`, - }), - }, - }); - } + if (str.length < min || str.length > max) { + throw FieldErrors({ + [key]: { + code: "BASE_TYPE_BAD_LENGTH", + message: req.t("common:field.BASE_TYPE_BAD_LENGTH", { + length: `${min} - ${max}`, + }), + }, + }); + } } export function generateCode() { - return ntob(Date.now() + Random.nextInt(0, 10000)); + return ntob(Date.now() + Random.nextInt(0, 10000)); }