UNPKG

632 BJavaScriptView Raw
1import { monthsInQuarter } from "./constants.js";
2
3/**
4 * @name quartersToMonths
5 * @category Conversion Helpers
6 * @summary Convert number of quarters to months.
7 *
8 * @description
9 * Convert a number of quarters to a full number of months.
10 *
11 * @param quarters - The number of quarters to be converted
12 *
13 * @returns The number of quarters converted in months
14 *
15 * @example
16 * // Convert 2 quarters to months
17 * const result = quartersToMonths(2)
18 * //=> 6
19 */
20export function quartersToMonths(quarters) {
21 return Math.trunc(quarters * monthsInQuarter);
22}
23
24// Fallback for modularized imports:
25export default quartersToMonths;