aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/abbreviatedNumber.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-03 17:43:03 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-03 17:43:03 -0400
commite8da6cf4fe2f8ab80167360c6c63a3c701eef101 (patch)
treed9e0776bbfeec49148b593ff938c3f81105a8db9 /src/arguments/abbreviatedNumber.ts
parent86cb31c8ec889177393814139dabd49722474cc6 (diff)
downloadtanzanite-e8da6cf4fe2f8ab80167360c6c63a3c701eef101.tar.gz
tanzanite-e8da6cf4fe2f8ab80167360c6c63a3c701eef101.tar.bz2
tanzanite-e8da6cf4fe2f8ab80167360c6c63a3c701eef101.zip
add pm2 metrics and fix abbreviatednumber type caster
Diffstat (limited to 'src/arguments/abbreviatedNumber.ts')
-rw-r--r--src/arguments/abbreviatedNumber.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/arguments/abbreviatedNumber.ts b/src/arguments/abbreviatedNumber.ts
index 9da7063..99f6df7 100644
--- a/src/arguments/abbreviatedNumber.ts
+++ b/src/arguments/abbreviatedNumber.ts
@@ -2,5 +2,10 @@ import { BushArgumentTypeCaster } from '@lib';
import numeral = require('numeral');
export const abbreviatedNumberTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
- return numeral(phrase?.toLowerCase()).value();
+ if (!phrase) return null;
+ const num = numeral(phrase?.toLowerCase()).value();
+
+ if (!num || isNaN(num)) return null;
+
+ return num;
};