From 524b5df7231635682053d0c028b0a24189b875ab Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 12 Aug 2021 20:09:35 +0200 Subject: :sparkles: api --- src/util/String.ts | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/util/String.ts (limited to 'src/util/String.ts') diff --git a/src/util/String.ts b/src/util/String.ts deleted file mode 100644 index 49fba237..00000000 --- a/src/util/String.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Request } from "express"; -import { ntob } from "./Base64"; -import { FieldErrors } from "./instanceOf"; - -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}` }), - }, - }); - } -} - -export function generateCode() { - return ntob(Date.now() + Math.randomIntBetween(0, 10000)); -} -- cgit 1.5.1