react-shields.io
Version:
react-shields.io ===
64 lines (49 loc) • 2.61 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
import Base from '../common/Base';
var Activity =
/*#__PURE__*/
function (_Base) {
_inherits(Activity, _Base);
function Activity(props) {
var _this;
_classCallCheck(this, Activity);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Activity).call(this, _objectSpread({
platform: 'github',
type: 'downloads',
total: true
}, props)));
_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;
}(Base);
export { Activity as default };
//# sourceMappingURL=Downloads.js.map