blob: e6791e66b5232007f97c170cdd6b448ddac8cc74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import { BushArgumentTypeCaster } from '@lib';
import numeral = require('numeral');
export const abbreviatedNumberTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
if (!phrase) return null;
const num = numeral(phrase?.toLowerCase()).value();
if (num === undefined || num === null || isNaN(num)) return null;
return num;
};
|