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