MCPcopy Index your code
hub / github.com/simstudioai/sim / personalUsageSnapshotFromStats

Function personalUsageSnapshotFromStats

apps/sim/lib/billing/threshold-billing.ts:561–573  ·  view source on GitHub ↗
(stats: {
  currentPeriodCost: string | number | null
  proPeriodCostSnapshot: string | number | null
  proPeriodCostSnapshotAt: Date | null
  lastPeriodCost: string | number | null
})

Source from the content-addressed store, hash-verified

559}
560
561function personalUsageSnapshotFromStats(stats: {
562 currentPeriodCost: string | number | null
563 proPeriodCostSnapshot: string | number | null
564 proPeriodCostSnapshotAt: Date | null
565 lastPeriodCost: string | number | null
566}): PersonalUsageSnapshot {
567 return {
568 currentPeriodCost: toNumber(toDecimal(stats.currentPeriodCost)),
569 proPeriodCostSnapshot: toNumber(toDecimal(stats.proPeriodCostSnapshot)),
570 proPeriodCostSnapshotAt: stats.proPeriodCostSnapshotAt,
571 lastPeriodCost: toNumber(toDecimal(stats.lastPeriodCost)),
572 }
573}
574
575function personalUsageSnapshotMatches(
576 expected: PersonalUsageSnapshot,

Callers 2

getPersonalUsageSnapshotFunction · 0.85

Calls 2

toNumberFunction · 0.90
toDecimalFunction · 0.90

Tested by

no test coverage detected