react-shields.io
Version:
Shields.io for react component, Quality metadata badges for open source projects.
75 lines (54 loc) • 2.82 kB
JavaScript
;
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: 'downloads',
total: true
});
_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,
tag = _this$state.tag,
path = _this$state.path,
total = _this$state.total;
if (platform !== 'github' || !/^(downloads|downloads-pre)/.test(type || '')) return '';
var baseData = [base, platform, type, user, repo];
if (path && tag) {
return [].concat(baseData, [tag, path]).join('/');
}
if (total && tag || type === 'downloads-pre' && tag && total) {
return [].concat(baseData, [tag, 'total']).join('/');
}
if (total) {
return [].concat(baseData, ['total']).join('/');
}
return '';
};
return _this;
}
return Activity;
}(_Base2.default);
exports.default = Activity;
module.exports = exports.default;
//# sourceMappingURL=Downloads.js.map