From 5503edd70bad06db9f54bbbc76f0dbf19276bc91 Mon Sep 17 00:00:00 2001 From: smyalygames Date: Fri, 17 Feb 2023 02:53:55 +0000 Subject: [PATCH] feat(utils): add isNumber --- src/utils/maths.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/maths.ts b/src/utils/maths.ts index 458839c..cbb9859 100644 --- a/src/utils/maths.ts +++ b/src/utils/maths.ts @@ -16,6 +16,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +/** + * Checks if any parsed value is a number. + * @param number check if variable is a number + * @returns {boolean} true if it is a number + */ +export function isNumber(number: any) { + return !Number.isNaN(+number); +} + /** * Creates a (PRNG) random integer between minimum and maximum both inclusive * @param min minimum integer