return-data
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -69,4 +69,5 @@ "use strict"; | ||
BaseReturn.isNetWorkError = function (data) { | ||
return (BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR"); | ||
return ((BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR") || | ||
(data === null || data === void 0 ? void 0 : data.status) === "NETWORK_ERROR"); | ||
}; | ||
@@ -73,0 +74,0 @@ /** |
@@ -76,4 +76,5 @@ "use strict"; | ||
ReturnData.isNetWorkError = function (data) { | ||
return (BaseReturn_1.default.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR"); | ||
return ((BaseReturn_1.default.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR") || | ||
(data === null || data === void 0 ? void 0 : data.status) === "NETWORK_ERROR"); | ||
}; | ||
@@ -80,0 +81,0 @@ /** |
@@ -67,4 +67,5 @@ var BaseReturn = /** @class */ (function () { | ||
BaseReturn.isNetWorkError = function (data) { | ||
return (BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR"); | ||
return ((BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR") || | ||
(data === null || data === void 0 ? void 0 : data.status) === "NETWORK_ERROR"); | ||
}; | ||
@@ -201,4 +202,5 @@ /** | ||
ReturnData.isNetWorkError = function (data) { | ||
return (BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR"); | ||
return ((BaseReturn.getStatusIsFunction(data) && | ||
data.getStatus() === "NETWORK_ERROR") || | ||
(data === null || data === void 0 ? void 0 : data.status) === "NETWORK_ERROR"); | ||
}; | ||
@@ -205,0 +207,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).ReturnData={})}(this,(function(t){"use strict";var n=function(){function t(t,n,e){void 0===t&&(t=""),void 0===n&&(n=null),void 0===e&&(e=""),this.status="",this.msg="",this.data=null,this.extraData=null,this.status=t,this.msg=e,this.data=n}return t.prototype.setStatus=function(t){this.status=t},t.prototype.setMsg=function(t){this.msg=t},t.prototype.setData=function(t){this.data=t},t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.getStatusIsFunction=function(t){return t&&"function"==typeof t.getStatus},t.getStatusValue=function(n){return t.getStatusIsFunction(n)?n.getStatus():""},t.isOk=function(n){return t.getStatusIsFunction(n)&&"ok"===n.getStatus()},t.isFail=function(n){return t.getStatusIsFunction(n)&&"fail"===n.getStatus()},t.isDeny=function(n){return t.getStatusIsFunction(n)&&"deny"===n.getStatus()},t.isNetWorkError=function(n){return t.getStatusIsFunction(n)&&"NETWORK_ERROR"===n.getStatus()},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.cancel=function(t){return new this("CANCEL",null,t||"网络异常,请重试")},t.isCancel=function(n){return"CANCEL"===t.getStatusValue(n)},t.interrupt=function(t){return new this("INTERRUPT",null,t||"程序中断,请重试")},t.isInterrupt=function(n){return"INTERRUPT"===t.getStatusValue(n)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(n){return"ERROR"===t.getStatusValue(n)},t}(),e=function(){function t(t,n,e){void 0===n&&(n=null),void 0===e&&(e="success"),this.msg="",this.extraData=null,this.status=t,this.data=n,this.msg=e}return t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.isOk=function(t){return u(t)&&"ok"===t.getStatus()},t.isFail=function(t){return u(t)&&"fail"===t.getStatus()},t.isDeny=function(t){return u(t)&&"deny"===t.getStatus()},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.isNetWorkError=function(t){return n.getStatusIsFunction(t)&&"NETWORK_ERROR"===t.getStatus()},t.cover=function(n,e){t[n]=e},t.success=function(n){return new t("ok",n)},t.fail=function(n){var e=new t("fail",null);return e.setMsg(n||""),e},t.exception=function(n){return new t(n.getStatus(),n.getData(),n.getMsg())},t.deny=function(n){return new t("deny",null,n||"")},t.networkError=function(n){return new t("NETWORK_ERROR",null,n||"网络异常,请重试")},t.interrupt=function(n){return new t("INTERRUPT",null,n||"程序中断,请重试")},t.isInterrupt=function(t){return"INTERRUPT"===n.getStatusValue(t)},t.cancel=function(n){return new t("CANCEL",null,n||"网络异常,请重试")},t.isCancel=function(t){return"CANCEL"===n.getStatusValue(t)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(t){return"ERROR"===n.getStatusValue(t)},t}();function u(t){return t&&"function"==typeof t.getStatus}t.BaseReturn=n,t.default=e,Object.defineProperty(t,"__esModule",{value:!0})}));//# sourceMappingURL=return-data.min.js.map | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).ReturnData={})}(this,(function(t){"use strict";var n=function(){function t(t,n,e){void 0===t&&(t=""),void 0===n&&(n=null),void 0===e&&(e=""),this.status="",this.msg="",this.data=null,this.extraData=null,this.status=t,this.msg=e,this.data=n}return t.prototype.setStatus=function(t){this.status=t},t.prototype.setMsg=function(t){this.msg=t},t.prototype.setData=function(t){this.data=t},t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.getStatusIsFunction=function(t){return t&&"function"==typeof t.getStatus},t.getStatusValue=function(n){return t.getStatusIsFunction(n)?n.getStatus():""},t.isOk=function(n){return t.getStatusIsFunction(n)&&"ok"===n.getStatus()},t.isFail=function(n){return t.getStatusIsFunction(n)&&"fail"===n.getStatus()},t.isDeny=function(n){return t.getStatusIsFunction(n)&&"deny"===n.getStatus()},t.isNetWorkError=function(n){return t.getStatusIsFunction(n)&&"NETWORK_ERROR"===n.getStatus()||"NETWORK_ERROR"===(null==n?void 0:n.status)},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.cancel=function(t){return new this("CANCEL",null,t||"网络异常,请重试")},t.isCancel=function(n){return"CANCEL"===t.getStatusValue(n)},t.interrupt=function(t){return new this("INTERRUPT",null,t||"程序中断,请重试")},t.isInterrupt=function(n){return"INTERRUPT"===t.getStatusValue(n)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(n){return"ERROR"===t.getStatusValue(n)},t}(),e=function(){function t(t,n,e){void 0===n&&(n=null),void 0===e&&(e="success"),this.msg="",this.extraData=null,this.status=t,this.data=n,this.msg=e}return t.prototype.getStatus=function(){return this.status},t.prototype.getData=function(){return this.data},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t.prototype.getExtraData=function(){return this.extraData},t.prototype.setExtraData=function(t){this.extraData=t},t.isOk=function(t){return u(t)&&"ok"===t.getStatus()},t.isFail=function(t){return u(t)&&"fail"===t.getStatus()},t.isDeny=function(t){return u(t)&&"deny"===t.getStatus()},t.hasData=function(t){if(!t||"function"!=typeof t.getData)return!1;var n=t.getData();return!(null==n)},t.isNetWorkError=function(t){return n.getStatusIsFunction(t)&&"NETWORK_ERROR"===t.getStatus()||"NETWORK_ERROR"===(null==t?void 0:t.status)},t.cover=function(n,e){t[n]=e},t.success=function(n){return new t("ok",n)},t.fail=function(n){var e=new t("fail",null);return e.setMsg(n||""),e},t.exception=function(n){return new t(n.getStatus(),n.getData(),n.getMsg())},t.deny=function(n){return new t("deny",null,n||"")},t.networkError=function(n){return new t("NETWORK_ERROR",null,n||"网络异常,请重试")},t.interrupt=function(n){return new t("INTERRUPT",null,n||"程序中断,请重试")},t.isInterrupt=function(t){return"INTERRUPT"===n.getStatusValue(t)},t.cancel=function(n){return new t("CANCEL",null,n||"网络异常,请重试")},t.isCancel=function(t){return"CANCEL"===n.getStatusValue(t)},t.error=function(t){return new this("ERROR",null,t||"程序中断,请重试")},t.isError=function(t){return"ERROR"===n.getStatusValue(t)},t}();function u(t){return t&&"function"==typeof t.getStatus}t.BaseReturn=n,t.default=e,Object.defineProperty(t,"__esModule",{value:!0})}));//# sourceMappingURL=return-data.min.js.map |
{ | ||
"name": "return-data", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "数据返回格式", | ||
@@ -5,0 +5,0 @@ "author": "yiri.zhou", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70341
1029