hugoWebsite/node_modules/date-fns/secondsToMinutes/index.js

43 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = secondsToMinutes;
var _index = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
var _index2 = require("../constants/index.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @name secondsToMinutes
* @category Conversion Helpers
* @summary Convert seconds to minutes.
*
* @description
* Convert a number of seconds to a full number of minutes.
*
* @param {number} seconds - number of seconds to be converted
*
* @returns {number} the number of seconds converted in minutes
* @throws {TypeError} 1 argument required
*
* @example
* // Convert 120 seconds into minutes
* const result = secondsToMinutes(120)
* //=> 2
*
* @example
* // It uses floor rounding:
* const result = secondsToMinutes(119)
* //=> 1
*/
function secondsToMinutes(seconds) {
(0, _index.default)(1, arguments);
var minutes = seconds / _index2.secondsInMinute;
return Math.floor(minutes);
}
module.exports = exports.default;