@byline/cli 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,10 +35,22 @@ import {
|
|
|
35
35
|
Select,
|
|
36
36
|
} from '@byline/ui/react'
|
|
37
37
|
|
|
38
|
-
import { formatNumber } from '@/utils/utils.general'
|
|
39
38
|
import styles from './media-list-view.module.css'
|
|
40
39
|
import { FormatBadge } from './media-thumbnail'
|
|
41
40
|
|
|
41
|
+
export function formatNumber(number: number, decimalPlaces: number) {
|
|
42
|
+
if (typeof number !== 'number' || Number.isNaN(number)) {
|
|
43
|
+
throw new TypeError('Input must be a valid number')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const options = {
|
|
47
|
+
minimumFractionDigits: decimalPlaces !== undefined ? decimalPlaces : 0,
|
|
48
|
+
maximumFractionDigits: decimalPlaces !== undefined ? decimalPlaces : 20,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return number.toLocaleString('en-US', options)
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
// ---------------------------------------------------------------------------
|
|
43
55
|
// Order-by config
|
|
44
56
|
// ---------------------------------------------------------------------------
|