{"size": 1028, "ext": "js", "max_stars_repo_path": "node_modules/.1.8.11@dayjs/esm/plugin/quarterOfYear/index.js", "max_stars_repo_name": "henrickcn/admin-tpl", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/.1.8.11@dayjs/esm/plugin/quarterOfYear/index.js", "max_issues_repo_name": "henrickcn/admin-tpl", "max_issues_repo_issues_event_min_datetime": "2021-03-09T17:34:45.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:39:49.000Z", "max_forks_repo_path": "node_modules/dayjs/esm/plugin/quarterOfYear/index.js", "max_forks_repo_name": "dongsheng-pro/shoubi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 25.0731707317, "max_line_length": 119, "alphanum_fraction": 0.5856031128}
import { Q, M, D } from '../../constant';
export default (function (o, c) {
  var proto = c.prototype;

  proto.quarter = function (quarter) {
    if (!this.$utils().u(quarter)) {
      return this.add((quarter - 1) * 3, M);
    }

    return Math.ceil((this.month() + 1) / 3);
  };

  var oldAdd = proto.add;

  proto.add = function (number, units) {
    number = Number(number); // eslint-disable-line no-param-reassign

    var unit = this.$utils().p(units);

    if (unit === Q) {
      return this.add(number * 3, M);
    }

    return oldAdd.bind(this)(number, units);
  };

  var oldStartOf = proto.startOf;

  proto.startOf = function (units, startOf) {
    var utils = this.$utils();
    var isStartOf = !utils.u(startOf) ? startOf : true;
    var unit = utils.p(units);

    if (unit === Q) {
      var quarter = this.quarter() - 1;
      return isStartOf ? this.month(quarter * 3).startOf(M).startOf(D) : this.month(quarter * 3 + 2).endOf(M).endOf(D);
    }

    return oldStartOf.bind(this)(units, startOf);
  };
});