react-shields.io
Version:
Shields.io for react component, Quality metadata badges for open source projects.
71 lines (52 loc) • 2.39 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(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; } }
import Base from '../common/Base';
var Analysis = /*#__PURE__*/function (_Base) {
_inherits(Analysis, _Base);
var _super = _createSuper(Analysis);
function Analysis(props) {
var _this;
_classCallCheck(this, Analysis);
_this = _super.call(this, props, {
platform: 'github',
type: 'languages-count'
});
_this.getUrl = function () {
var _this$state = _this.state,
base = _this$state.base,
platform = _this$state.platform,
type = _this$state.type,
user = _this$state.user,
repo = _this$state.repo,
query = _this$state.query;
var typePath = '';
switch (type) {
case 'languages-count':
typePath = 'languages/count';
break;
case 'languages-top':
typePath = 'languages/top';
break;
case 'search':
typePath = 'search';
break;
default:
break;
}
if (platform !== 'github' || !typePath) return '';
var baseData = [base, platform, typePath, user, repo];
if (query) {
return [].concat(baseData, [query]).join('/');
}
return baseData.join('/');
};
return _this;
}
return Analysis;
}(Base);
export { Analysis as default };
//# sourceMappingURL=Analysis.js.map