index.js 944 B

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