UNPKG

pricing4ts

Version:

![NPM Version](https://img.shields.io/npm/v/pricing4ts) Pricing4TS is a TypeScript-based toolkit designed to enhance the server-side functionality of a pricing-driven SaaS by enabling the seamless integration of pricing plans into the application logic. T

28 lines (19 loc) 776 B
// deno-lint-ignore-file no-explicit-any import { calculateNextVersion } from '../../version-manager'; export default function v20Tov21Updater(extractedPricing: any): any { const nextVersion = calculateNextVersion(extractedPricing.version); extractedPricing.version = nextVersion!; _refactorPricingVersion(extractedPricing); return extractedPricing; } function _refactorPricingVersion(extractedPricing: any) { extractedPricing.syntaxVersion = extractedPricing.version; const createdAt = new Date(extractedPricing.createdAt); if (createdAt.toString() === 'Invalid Date') { extractedPricing.version = 'latest'; } else { extractedPricing.version = `${createdAt.getFullYear()}-${ createdAt.getMonth() + 1 }-${createdAt.getDate()}`; } }