26 lines
674 B
JavaScript
26 lines
674 B
JavaScript
|
import { millisecondsInMinute } from "./constants.mjs";
|
||
|
|
||
|
/**
|
||
|
* @name minutesToMilliseconds
|
||
|
* @category Conversion Helpers
|
||
|
* @summary Convert minutes to milliseconds.
|
||
|
*
|
||
|
* @description
|
||
|
* Convert a number of minutes to a full number of milliseconds.
|
||
|
*
|
||
|
* @param minutes - The number of minutes to be converted
|
||
|
*
|
||
|
* @returns The number of minutes converted in milliseconds
|
||
|
*
|
||
|
* @example
|
||
|
* // Convert 2 minutes to milliseconds
|
||
|
* const result = minutesToMilliseconds(2)
|
||
|
* //=> 120000
|
||
|
*/
|
||
|
export function minutesToMilliseconds(minutes) {
|
||
|
return Math.trunc(minutes * millisecondsInMinute);
|
||
|
}
|
||
|
|
||
|
// Fallback for modularized imports:
|
||
|
export default minutesToMilliseconds;
|