UNPKG

@automattic/calypso-products

Version:

This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.

20 lines 655 B
export function getPriceTierForUnits(tiers, units) { const firstUnboundedTier = tiers.find((tier) => !tier.maximum_units); let matchingTier = tiers.find((tier) => { if (!tier.maximum_units) { return false; } if (units >= tier.minimum_units && units <= tier.maximum_units) { return true; } return false; }); if (!matchingTier && firstUnboundedTier && units >= firstUnboundedTier.minimum_units) { matchingTier = firstUnboundedTier; } if (!matchingTier) { return null; } return matchingTier; } //# sourceMappingURL=get-price-tier-for-units.js.map