// Code generated by coz. DO NOT EDIT. /** * Mixin for get * @protected * @memberOf module:@the-/date.mixins * @function getMix * @param {function} Class * @returns {function} Class */ 'use strict' /** @lends module:@the-/date.mixins.getMix */ function getMix (Class) { const units = {{{unitsString}}} /** * @inner * @memberOf module:@the-/date.mixins.getMix * @class GetMixed */ class GetMixed extends Class { /** * Get value of * @param {string} unit - Unit to get * @see https://momentjs.com/docs/#/get-set/get/ * @returns {number} */ get (unit = '{{defaultUnit}}') { unit = this.normalizeMomentUnits(unit) const unknown = !units.includes(unit) if (unknown) { throw new Error(`[TheDate] Unsupported unit: ${unit}`) } const moment = this.toMoment() return moment.get(unit) } {{#each units}} /** * Get {{this}} * @returns {TheDate} */ get{{pascalcase this}} () { return this.get('{{this}}') } {{/each}} } return GetMixed } module.exports = getMix