Comparing version 0.1.6 to 0.1.7
@@ -1,1 +0,1 @@ | ||
function t(t){const[o]=Object.prototype.toString.call(t).match(/[A-Z]\w+/);return o.toLocaleLowerCase()}export{t as typeOf}; | ||
function t(t){return Object.prototype.toString.call(t).match(/[A-Z]\w+/)[0].toLocaleLowerCase()}export{t as typeOf}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.typeOf=function(e){const[t]=Object.prototype.toString.call(e).match(/[A-Z]\w+/);return t.toLocaleLowerCase()}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.typeOf=function(e){return Object.prototype.toString.call(e).match(/[A-Z]\w+/)[0].toLocaleLowerCase()}; |
@@ -1,1 +0,1 @@ | ||
class t{baseOptions;constructor(t){this.baseOptions=t??{}}request(t){return t.url=`${this.baseOptions?.baseURL??""}${t?.url}`,!0!==t.qs||"object"!==function(t){const[e]=Object.prototype.toString.call(t).match(/[A-Z]\w+/);return e.toLocaleLowerCase()}(t.data)||"POST"!==t.method&&"PUT"!==t.method||(t.url+=this.qs(t.data)),new Promise(((e,r)=>{wx.request({...this.baseOptions,...t,success:t=>e(t),fail:t=>r(t)})}))}static create(e){return new t(e)}weioFactory(t){return e=>(e.method=t,this.request(e))}qs(t){return`?${Object.keys(t).map((e=>`${e}=${t[e]}`)).join("&")}`}get(t,e){return this.weioFactory("GET")({url:t,data:e?.params,...e})}post(t,e,r){return this.weioFactory("POST")({url:t,data:e,...r})}put(t,e,r){return this.weioFactory("PUT")({url:t,data:e,...r})}delete(t,e){return this.weioFactory("DELETE")({url:t,data:e?.params,...e})}options(t,e){return this.weioFactory("OPTIONS")({url:t,data:e?.params,...e})}head(t,e){return this.weioFactory("HEAD")({url:t,data:e?.params,...e})}}export{t as default}; | ||
var t=function(){return t=Object.assign||function(t){for(var o,r=1,n=arguments.length;r<n;r++)for(var e in o=arguments[r])Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e]);return t},t.apply(this,arguments)};var o=function(){function o(t){this.baseOptions=null!=t?t:{}}return o.prototype.request=function(o){var r,n,e,a=this;return o.url="".concat(null!==(n=null===(r=this.baseOptions)||void 0===r?void 0:r.baseURL)&&void 0!==n?n:"").concat(null==o?void 0:o.url),!0!==o.qs||"object"!==(e=o.data,Object.prototype.toString.call(e).match(/[A-Z]\w+/)[0].toLocaleLowerCase())||"POST"!==o.method&&"PUT"!==o.method||(o.url+=this.qs(o.data)),new Promise((function(r,n){wx.request(t(t(t({},a.baseOptions),o),{success:function(t){return r(t)},fail:function(t){return n(t)}}))}))},o.create=function(t){return new o(t)},o.prototype.weioFactory=function(t){var o=this;return function(r){return r.method=t,o.request(r)}},o.prototype.qs=function(t){return"?".concat(Object.keys(t).map((function(o){return"".concat(o,"=").concat(t[o])})).join("&"))},o.prototype.get=function(o,r){return this.weioFactory("GET")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.post=function(o,r,n){return this.weioFactory("POST")(t({url:o,data:r},n))},o.prototype.put=function(o,r,n){return this.weioFactory("PUT")(t({url:o,data:r},n))},o.prototype.delete=function(o,r){return this.weioFactory("DELETE")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.options=function(o,r){return this.weioFactory("OPTIONS")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.head=function(o,r){return this.weioFactory("HEAD")(t({url:o,data:null==r?void 0:r.params},r))},o}();export{o as default}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t{baseOptions;constructor(t){this.baseOptions=t??{}}request(t){return t.url=`${this.baseOptions?.baseURL??""}${t?.url}`,!0!==t.qs||"object"!==function(t){const[e]=Object.prototype.toString.call(t).match(/[A-Z]\w+/);return e.toLocaleLowerCase()}(t.data)||"POST"!==t.method&&"PUT"!==t.method||(t.url+=this.qs(t.data)),new Promise(((e,r)=>{wx.request({...this.baseOptions,...t,success:t=>e(t),fail:t=>r(t)})}))}static create(e){return new t(e)}weioFactory(t){return e=>(e.method=t,this.request(e))}qs(t){return`?${Object.keys(t).map((e=>`${e}=${t[e]}`)).join("&")}`}get(t,e){return this.weioFactory("GET")({url:t,data:e?.params,...e})}post(t,e,r){return this.weioFactory("POST")({url:t,data:e,...r})}put(t,e,r){return this.weioFactory("PUT")({url:t,data:e,...r})}delete(t,e){return this.weioFactory("DELETE")({url:t,data:e?.params,...e})}options(t,e){return this.weioFactory("OPTIONS")({url:t,data:e?.params,...e})}head(t,e){return this.weioFactory("HEAD")({url:t,data:e?.params,...e})}}exports.default=t; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){return t=Object.assign||function(t){for(var o,r=1,e=arguments.length;r<e;r++)for(var n in o=arguments[r])Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);return t},t.apply(this,arguments)};var o=function(){function o(t){this.baseOptions=null!=t?t:{}}return o.prototype.request=function(o){var r,e,n,u=this;return o.url="".concat(null!==(e=null===(r=this.baseOptions)||void 0===r?void 0:r.baseURL)&&void 0!==e?e:"").concat(null==o?void 0:o.url),!0!==o.qs||"object"!==(n=o.data,Object.prototype.toString.call(n).match(/[A-Z]\w+/)[0].toLocaleLowerCase())||"POST"!==o.method&&"PUT"!==o.method||(o.url+=this.qs(o.data)),new Promise((function(r,e){wx.request(t(t(t({},u.baseOptions),o),{success:function(t){return r(t)},fail:function(t){return e(t)}}))}))},o.create=function(t){return new o(t)},o.prototype.weioFactory=function(t){var o=this;return function(r){return r.method=t,o.request(r)}},o.prototype.qs=function(t){return"?".concat(Object.keys(t).map((function(o){return"".concat(o,"=").concat(t[o])})).join("&"))},o.prototype.get=function(o,r){return this.weioFactory("GET")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.post=function(o,r,e){return this.weioFactory("POST")(t({url:o,data:r},e))},o.prototype.put=function(o,r,e){return this.weioFactory("PUT")(t({url:o,data:r},e))},o.prototype.delete=function(o,r){return this.weioFactory("DELETE")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.options=function(o,r){return this.weioFactory("OPTIONS")(t({url:o,data:null==r?void 0:r.params},r))},o.prototype.head=function(o,r){return this.weioFactory("HEAD")(t({url:o,data:null==r?void 0:r.params},r))},o}();exports.default=o; |
{ | ||
"name": "weio", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Promise based HTTP client for for wechat miniprogram", | ||
@@ -43,2 +43,3 @@ "main": "./lib/weio.js", | ||
"dev": "cross-env NODE_ENV=development yarn rollup -c -w", | ||
"build:dev": "cross-env NODE_ENV=development yarn rollup -c", | ||
"build": "cross-env NODE_ENV=production yarn rollup -c", | ||
@@ -48,2 +49,3 @@ "prepublishOnly": "yarn build" | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.19.3", | ||
"@rollup/plugin-commonjs": "^23.0.0", | ||
@@ -50,0 +52,0 @@ "@rollup/plugin-node-resolve": "^14.1.0", |
@@ -11,3 +11,3 @@ # Weio | ||
# npm | ||
npm add weio -S --registry=https://registry.npmjs.org/ | ||
npm i weio -S --registry=https://registry.npmjs.org/ | ||
``` | ||
@@ -14,0 +14,0 @@ |
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
10133
168
9