From 10b101e6afb906afe311b796bbe7a7dd94682441 Mon Sep 17 00:00:00 2001 From: Ivan Gabaldon Date: Tue, 5 Mar 2024 17:04:41 +0100 Subject: [PATCH] dumb --- src/utils/StringUtils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/utils/StringUtils.ts b/src/utils/StringUtils.ts index 108fe93..5540387 100644 --- a/src/utils/StringUtils.ts +++ b/src/utils/StringUtils.ts @@ -14,9 +14,9 @@ export class StringUtils { return string; } - public static generateKey(length: number): string { + public static generateKey(length: number = Server.config.documents.defaultKeyLength): string { if ( - ValidatorUtils.isLengthWithinRange( + !ValidatorUtils.isLengthWithinRange( length, Server.config.documents.minKeyLength, Server.config.documents.maxKeyLength @@ -32,10 +32,9 @@ export class StringUtils { return Bun.file(Server.config.documents.documentPath + key).exists(); } - public static async createKey(length: number | undefined): Promise { + public static async createKey(length: number = Server.config.documents.defaultKeyLength): Promise { if ( - !length || - ValidatorUtils.isLengthWithinRange( + !ValidatorUtils.isLengthWithinRange( length, Server.config.documents.minKeyLength, Server.config.documents.maxKeyLength