UNPKG

react-shields.io

Version:

Shields.io for react component, Quality metadata badges for open source projects.

82 lines (59 loc) 3.13 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _Base2 = _interopRequireDefault(require("../common/Base")); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } var Activity = /*#__PURE__*/function (_Base) { (0, _inherits2.default)(Activity, _Base); var _super = _createSuper(Activity); function Activity(props) { var _this; (0, _classCallCheck2.default)(this, Activity); _this = _super.call(this, props, { platform: 'github', type: 'commits-since' }); _this.getUrl = function () { var _this$state = _this.state, type = _this$state.type, platform = _this$state.platform, user = _this$state.user, repo = _this$state.repo, base = _this$state.base, interval = _this$state.interval, variant = _this$state.variant, version = _this$state.version, branch = _this$state.branch; if (platform !== 'github') return ''; if (type === 'commits-since' && version && branch) { return [base, platform, type, user, repo, version, branch].join('/'); } if (type === 'commit-activity' && interval) { return [base, platform, type, interval, user, repo].join('/'); } if (type === 'variant' && variant) { return [base, platform, type, variant, user, repo].join('/'); } if (type === 'last-commit') { return branch ? [base, platform, type, user, repo, branch].join('/') : [base, platform, type, user, repo].join('/'); } if (type && /^release\-(date|date\-pre)/.test(type)) { return [base, platform, type, user, repo].join('/'); } return ''; }; return _this; } return Activity; }(_Base2.default); exports.default = Activity; module.exports = exports.default; //# sourceMappingURL=Activity.js.map