index.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = secondsToHours;
  7. var _index = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  8. var _index2 = require("../constants/index.js");
  9. /**
  10. * @name secondsToHours
  11. * @category Conversion Helpers
  12. * @summary Convert seconds to hours.
  13. *
  14. * @description
  15. * Convert a number of seconds to a full number of hours.
  16. *
  17. * @param {number} seconds - number of seconds to be converted
  18. *
  19. * @returns {number} the number of seconds converted in hours
  20. * @throws {TypeError} 1 argument required
  21. *
  22. * @example
  23. * // Convert 7200 seconds into hours
  24. * const result = secondsToHours(7200)
  25. * //=> 2
  26. *
  27. * @example
  28. * // It uses floor rounding:
  29. * const result = secondsToHours(7199)
  30. * //=> 1
  31. */
  32. function secondsToHours(seconds) {
  33. (0, _index.default)(1, arguments);
  34. var hours = seconds / _index2.secondsInHour;
  35. return Math.floor(hours);
  36. }
  37. module.exports = exports.default;