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

Function getPrice

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

removeNonNumberFunction · 0.85

Tested by

no test coverage detected