MCPcopy Create free account
hub / github.com/dailydotdev/apps / getPrice

Function getPrice

packages/shared/src/lib/numberFormat.ts:42–53  ·  view source on GitHub ↗
(item: PaddleProductLineItem)

Source from the content-addressed store, hash-verified

40 value.replace(/,(\d{2})$/, '.$1').replace(/[^\d.]/g, '');
41
42export const getPrice = (item: PaddleProductLineItem): number => {
43 const priceAmount = parseFloat(item.totals.total);
44 const priceAmountFormatted = parseFloat(
45 removeNonNumber(item.formattedTotals.total),
46 );
47
48 if (priceAmount === priceAmountFormatted) {
49 return priceAmount;
50 }
51
52 return priceAmount / 100;
53};
54
55export const formatDataTileValue = (value: number): string => {
56 if (typeof value !== 'number' || !Number.isFinite(value)) {

Callers 1

Calls 1

removeNonNumberFunction · 0.85

Tested by

no test coverage detected