UNPKG

972 BJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.validProgress = validProgress;
9exports.getSuccessPercent = getSuccessPercent;
10
11var _devWarning = _interopRequireDefault(require("../_util/devWarning"));
12
13function validProgress(progress) {
14 if (!progress || progress < 0) {
15 return 0;
16 }
17
18 if (progress > 100) {
19 return 100;
20 }
21
22 return progress;
23}
24
25function getSuccessPercent(_ref) {
26 var success = _ref.success,
27 successPercent = _ref.successPercent;
28 var percent = successPercent;
29 /** @deprecated Use `percent` instead */
30
31 if (success && 'progress' in success) {
32 (0, _devWarning["default"])(false, 'Progress', '`success.progress` is deprecated. Please use `success.percent` instead.');
33 percent = success.progress;
34 }
35
36 if (success && 'percent' in success) {
37 percent = success.percent;
38 }
39
40 return percent;
41}
\No newline at end of file