From eec99669c8b6d08bf4153a58aa72dabd5aacdae0 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Fri, 6 Mar 2020 14:41:09 -0600 Subject: Deduplicate verifyNickname into a single importable function --- server/src/commands/utility/UAC/_info.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'server/src/commands/utility') diff --git a/server/src/commands/utility/UAC/_info.js b/server/src/commands/utility/UAC/_info.js index 6da85d5..d34a384 100644 --- a/server/src/commands/utility/UAC/_info.js +++ b/server/src/commands/utility/UAC/_info.js @@ -1,6 +1,6 @@ /** * User Account Control information containing level constants - * and simple helper functions used to verify permissions + * and simple helper functions related to users * @property {Object} levels - Defines labels for default permission ranges * @author MinusGix ( https://github.com/MinusGix ) * @version v1.0.0 @@ -83,3 +83,13 @@ export function isChannelTrusted(level) { export function isTrustedUser(level) { return level >= levels.trustedUser; } + +/** + * Returns true if the nickname is valid + * @public + * @param {String} nick + * @return {boolean} + */ +export function verifyNickname (nick) { + return /^[a-zA-Z0-9_]{1,24}$/.test(nick); +} \ No newline at end of file -- cgit v1.2.1