You've already forked tf2wikipricing
fix: unhandled error when numbers are null
This commit is contained in:
@@ -6,6 +6,8 @@ function toFixed(num: number, fixed: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatPrice(keys: number, metal: number, keyPrice: number, locale: string = 'en') {
|
export function formatPrice(keys: number, metal: number, keyPrice: number, locale: string = 'en') {
|
||||||
|
if(keys == null) keys = 0
|
||||||
|
if(metal == null) metal = 0
|
||||||
const formattedKeys = +(keys + (metal / keyPrice)).toFixed(2)
|
const formattedKeys = +(keys + (metal / keyPrice)).toFixed(2)
|
||||||
|
|
||||||
let output: string = ''
|
let output: string = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user