utils-uniapp 1.2.21 → 1.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../_rollupPluginBabelHelpers-3cc6d021.js");function j(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("compose 参数必须是函数");return t.length===0?function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.length===1?n[0]:n}:t.reduce(function(r,n){return function(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),l=0;l<s;l++)m[l]=arguments[l];return r.apply(a,m.concat(c))}].concat(c))}},function(r){return r})}function O(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("composeAsync 参数必须是函数");return t.length===0?f._asyncToGenerator(f._regenerator().m(function r(){var n,a,u,c=arguments;return f._regenerator().w(function(i){for(;;)switch(i.n){case 0:for(n=c.length,a=new Array(n),u=0;u<n;u++)a[u]=c[u];return i.a(2,a.length===1?a[0]:a)}},r)})):t.reduce(function(r,n){return f._asyncToGenerator(f._regenerator().m(function a(){var u=this,c,i,s,m=arguments;return f._regenerator().w(function(l){for(;;)switch(l.n){case 0:for(c=m.length,i=new Array(c),s=0;s<c;s++)i[s]=m[s];return l.a(2,n.call.apply(n,[this,f._asyncToGenerator(f._regenerator().m(function v(){var y,P,p,h=arguments;return f._regenerator().w(function(g){for(;;)switch(g.n){case 0:for(y=h.length,P=new Array(y),p=0;p<y;p++)P[p]=h[p];return g.a(2,r.apply(u,P.concat(i)))}},v)}))].concat(i)))}},a,this)}))},function(){var r=f._asyncToGenerator(f._regenerator().m(function n(a){return f._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,a)}},n)}));return function(n){return r.apply(this,arguments)}}())}function F(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("pipe 参数必须是函数");return t.length===0?function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.length===1?n[0]:n}:t.reverse().reduce(function(r,n){return function(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),l=0;l<s;l++)m[l]=arguments[l];return r.apply(a,m.concat(c))}].concat(c))}},function(r){return r})}function G(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("pipeAsync 参数必须是函数");return t.length===0?f._asyncToGenerator(f._regenerator().m(function r(){var n,a,u,c=arguments;return f._regenerator().w(function(i){for(;;)switch(i.n){case 0:for(n=c.length,a=new Array(n),u=0;u<n;u++)a[u]=c[u];return i.a(2,a.length===1?a[0]:a)}},r)})):t.reverse().reduce(function(r,n){return f._asyncToGenerator(f._regenerator().m(function a(){var u=this,c,i,s,m=arguments;return f._regenerator().w(function(l){for(;;)switch(l.n){case 0:for(c=m.length,i=new Array(c),s=0;s<c;s++)i[s]=m[s];return l.a(2,n.call.apply(n,[this,f._asyncToGenerator(f._regenerator().m(function v(){var y,P,p,h=arguments;return f._regenerator().w(function(g){for(;;)switch(g.n){case 0:for(y=h.length,P=new Array(y),p=0;p<y;p++)P[p]=h[p];return g.a(2,r.apply(u,P.concat(i)))}},v)}))].concat(i)))}},a,this)}))},function(){var r=f._asyncToGenerator(f._regenerator().m(function n(a){return f._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,a)}},n)}));return function(n){return r.apply(this,arguments)}}())}function I(e,t){var o=null;r.stop=function(){return o&&clearTimeout(o)};function r(){for(var n=this,a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return r.stop(),o=setTimeout(function(){e.apply(n,u)},t),o}return r}function U(e,t){var o=null,r=[];n.stop=function(){if(o){var a;(a=r.shift())===null||a===void 0||a("cancel"),clearTimeout(o)}};function n(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return new Promise(function(s,m){n.stop(),r.push(m),o=setTimeout(function(){s(e.apply(a,c))},t)})}return n}function H(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:500,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r,n,a=o?function(){if(!n){n=!0;for(var u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return typeof e=="function"&&e.apply(this,c),r=setTimeout(function(){n=!1},t),r}}:function(){for(var u=this,c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];if(!n)return n=!0,r=setTimeout(function(){n=!1,typeof e=="function"&&e.apply(u,i)},t),r};return a.stop=function(){return r&&clearTimeout(r)},a}function L(e){return encodeURIComponent(JSON.stringify(e||{}))}function J(e){return JSON.parse(decodeURIComponent(e||"{}"))}function R(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t.decode,r=o===void 0?!0:o,n=t.silent,a=n===void 0?!1:n,u=t.decodePlus,c=u===void 0?!0:u,i=t.strict,s=i===void 0?!1:i,m={};if(typeof e!="string")return m;function l(Q,_){if(!r)return Q;var T=Q;c&&(T=T.replace(/\+/g," "));try{return decodeURIComponent(T)}catch($){return a||console.warn("Failed to decode ".concat(_?"key":"value",": ").concat(T),$),s?null:(_&&(T=T.replace(/%[0-9a-f]{2}/gi,"")),T)}}var v=e.split("#")[0],y=v.indexOf("?"),P=y>=0?v.slice(y+1):v;if(!P)return m;for(var p=P.split("&"),h=0;h<p.length;h++){var g=p[h];if(g){var d=g.indexOf("="),w=void 0,A=void 0;d===-1?(w=g,A=""):(w=g.slice(0,d),A=g.slice(d+1));var S=l(w,!0);if(!(S===null||!S)){var b=l(A,!1);if(b!==null){var C=S,M=!1;/\[\]$/.test(S)?(C=S.slice(0,-2),M=!0):/^(.+)\[\d+\]$/.test(S)&&(C=S.replace(/\[\d+\]$/,""),M=!0);var E=m[C];E===void 0?m[C]=M?[b]:b:Array.isArray(E)?E.push(b):m[C]=[E,b]}}}}return m}function q(e){return typeof window=="undefined"?{}:R(window.location.search,e)}function B(e){if(typeof window=="undefined")return{};var t=window.location.hash,o=t.indexOf("?");if(o===-1)return{};var r=t.substring(o);return R(r,e)}function D(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-";return[Date.now().toString(),Math.random().toString(16).slice(2,10),Math.random().toString(16).slice(7),e.toString()].join(t)}function N(e){return e.replace(/([^-])([^-]*)/g,function(t,o,r){return o.toLocaleUpperCase()+r.toLocaleLowerCase()}).replace(/-/g,"")}function z(e,t){e=e.split("."),t=t.split(".");for(var o=Math.max(e.length,t.length);e.length<o;)e.push("0");for(;t.length<o;)t.push("0");for(var r=0;r<o;r++){var n=parseInt(e[r]),a=parseInt(t[r]);if(n>a)return 1;if(n<a)return-1}return 0}function V(){return"#"+Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}function W(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8,t=arguments.length>1?arguments[1]:void 0;e=e||32,t||(t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678");for(var o=t.length,r="",n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*o));return r}function X(e){var t,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||f._typeof(e)!=="object")return"";var r=o.addQuestionMark,n=r===void 0?!1:r,a=o.encode,u=a===void 0?!0:a,c=o.arrayFormat,i=c===void 0?"comma":c,s=o.keepEmptyArray,m=s===void 0?!1:s,l=[];function v(h){return u?encodeURIComponent(h):h}var y={indices:function(g,d){d.forEach(function(w,A){l.push("".concat(g,"[").concat(A,"]=").concat(v(w)))})},brackets:function(g,d){d.forEach(function(w){l.push("".concat(g,"[]=").concat(v(w)))})},repeat:function(g,d){d.forEach(function(w){l.push("".concat(g,"=").concat(v(w)))})},comma:function(g,d){var w=d.map(function(A){return v(A)}).join(",");l.push("".concat(g,"=").concat(w))}},P=(t=y[i])!==null&&t!==void 0?t:y.comma;Object.keys(e).forEach(function(h){var g=e[h];if(g!=null){var d=v(h);if(Array.isArray(g)){var w=g.filter(function(S){return S!=null});if(w.length===0){m&&l.push("".concat(d,"="));return}P(d,w);return}var A=g;f._typeof(A)==="object"&&A!==null&&(A=JSON.stringify(A)),l.push("".concat(d,"=").concat(v(A)))}});var p=l.join("&");return n&&p?"?".concat(p):p}function Y(e){var t=e.scene;return t&&(e=f._objectSpread2(f._objectSpread2({fromCode:!0},e),R(t))),e}exports.compareVersion=z;exports.compose=j;exports.composeAsync=O;exports.debounce=I;exports.debouncePromise=U;exports.decodeURIParams=J;exports.encodeURIParams=L;exports.getOnLoadParams=Y;exports.getPascalCase=N;exports.getQueryParams=R;exports.getQueryParamsFromHash=B;exports.getQueryParamsFromSearch=q;exports.getRandom=D;exports.getRandomStr=W;exports.pipe=F;exports.pipeAsync=G;exports.randomColor=V;exports.throttle=H;exports.toQueryString=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../_rollupPluginBabelHelpers-3cc6d021.js");function j(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("compose 参数必须是函数");return t.length===0?function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.length===1?n[0]:n}:t.reduce(function(r,n){return function(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),l=0;l<s;l++)m[l]=arguments[l];return r.apply(a,m.concat(c))}].concat(c))}},function(r){return r})}function I(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("composeAsync 参数必须是函数");return t.length===0?f._asyncToGenerator(f._regenerator().m(function r(){var n,a,u,c=arguments;return f._regenerator().w(function(i){for(;;)switch(i.n){case 0:for(n=c.length,a=new Array(n),u=0;u<n;u++)a[u]=c[u];return i.a(2,a.length===1?a[0]:a)}},r)})):t.reduce(function(r,n){return f._asyncToGenerator(f._regenerator().m(function a(){var u=this,c,i,s,m=arguments;return f._regenerator().w(function(l){for(;;)switch(l.n){case 0:for(c=m.length,i=new Array(c),s=0;s<c;s++)i[s]=m[s];return l.a(2,n.call.apply(n,[this,f._asyncToGenerator(f._regenerator().m(function v(){var y,P,d,h=arguments;return f._regenerator().w(function(g){for(;;)switch(g.n){case 0:for(y=h.length,P=new Array(y),d=0;d<y;d++)P[d]=h[d];return g.a(2,r.apply(u,P.concat(i)))}},v)}))].concat(i)))}},a,this)}))},function(){var r=f._asyncToGenerator(f._regenerator().m(function n(a){return f._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,a)}},n)}));return function(n){return r.apply(this,arguments)}}())}function O(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("pipe 参数必须是函数");return t.length===0?function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.length===1?n[0]:n}:t.reverse().reduce(function(r,n){return function(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),l=0;l<s;l++)m[l]=arguments[l];return r.apply(a,m.concat(c))}].concat(c))}},function(r){return r})}function U(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(t.some(function(r){return typeof r!="function"}))throw new TypeError("pipeAsync 参数必须是函数");return t.length===0?f._asyncToGenerator(f._regenerator().m(function r(){var n,a,u,c=arguments;return f._regenerator().w(function(i){for(;;)switch(i.n){case 0:for(n=c.length,a=new Array(n),u=0;u<n;u++)a[u]=c[u];return i.a(2,a.length===1?a[0]:a)}},r)})):t.reverse().reduce(function(r,n){return f._asyncToGenerator(f._regenerator().m(function a(){var u=this,c,i,s,m=arguments;return f._regenerator().w(function(l){for(;;)switch(l.n){case 0:for(c=m.length,i=new Array(c),s=0;s<c;s++)i[s]=m[s];return l.a(2,n.call.apply(n,[this,f._asyncToGenerator(f._regenerator().m(function v(){var y,P,d,h=arguments;return f._regenerator().w(function(g){for(;;)switch(g.n){case 0:for(y=h.length,P=new Array(y),d=0;d<y;d++)P[d]=h[d];return g.a(2,r.apply(u,P.concat(i)))}},v)}))].concat(i)))}},a,this)}))},function(){var r=f._asyncToGenerator(f._regenerator().m(function n(a){return f._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,a)}},n)}));return function(n){return r.apply(this,arguments)}}())}function F(e,t){var o=null;r.stop=function(){return o&&clearTimeout(o)};function r(){for(var n=this,a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return r.stop(),o=setTimeout(function(){e.apply(n,u)},t),o}return r}function G(e,t){var o=null,r=[];n.stop=function(){if(o){var a;(a=r.shift())===null||a===void 0||a("cancel"),clearTimeout(o)}};function n(){for(var a=this,u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return new Promise(function(s,m){n.stop(),r.push(m),o=setTimeout(function(){s(e.apply(a,c))},t)})}return n}function H(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:500,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r,n,a=o?function(){if(!n){n=!0;for(var u=arguments.length,c=new Array(u),i=0;i<u;i++)c[i]=arguments[i];return typeof e=="function"&&e.apply(this,c),r=setTimeout(function(){n=!1},t),r}}:function(){for(var u=this,c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];if(!n)return n=!0,r=setTimeout(function(){n=!1,typeof e=="function"&&e.apply(u,i)},t),r};return a.stop=function(){return r&&clearTimeout(r)},a}function L(e){return encodeURIComponent(JSON.stringify(e||{}))}function J(e){return JSON.parse(decodeURIComponent(e||"{}"))}function E(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t.decode,r=o===void 0?!0:o,n=t.silent,a=n===void 0?!1:n,u=t.decodePlus,c=u===void 0?!0:u,i=t.strict,s=i===void 0?!1:i,m={};if(typeof e!="string")return m;function l(Q,_){if(!r)return Q;var T=Q;c&&(T=T.replace(/\+/g," "));try{return decodeURIComponent(T)}catch($){return a||console.warn("Failed to decode ".concat(_?"key":"value",": ").concat(T),$),s?null:(_&&(T=T.replace(/%[0-9a-f]{2}/gi,"")),T)}}var v=e.split("#")[0],y=v.indexOf("?"),P=y>=0?v.slice(y+1):v;if(!P)return m;for(var d=P.split("&"),h=0;h<d.length;h++){var g=d[h];if(g){var p=g.indexOf("="),w=void 0,A=void 0;p===-1?(w=g,A=""):(w=g.slice(0,p),A=g.slice(p+1));var S=l(w,!0);if(!(S===null||!S)){var b=l(A,!1);if(b!==null){var C=S,M=!1;/\[\]$/.test(S)?(C=S.slice(0,-2),M=!0):/^(.+)\[\d+\]$/.test(S)&&(C=S.replace(/\[\d+\]$/,""),M=!0);var R=m[C];R===void 0?m[C]=M?[b]:b:Array.isArray(R)?R.push(b):m[C]=[R,b]}}}}return m}function q(e){return typeof window=="undefined"?{}:E(window.location.search,e)}function B(e){if(typeof window=="undefined")return{};var t=window.location.hash,o=t.indexOf("?");if(o===-1)return{};var r=t.substring(o);return E(r,e)}function D(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-";return[Date.now().toString(),Math.random().toString(16).slice(2,10),Math.random().toString(16).slice(7),e.toString()].join(t)}function N(e){return e.replace(/([^-])([^-]*)/g,function(t,o,r){return o.toLocaleUpperCase()+r.toLocaleLowerCase()}).replace(/-/g,"")}function z(e,t){e=e.split("."),t=t.split(".");for(var o=Math.max(e.length,t.length);e.length<o;)e.push("0");for(;t.length<o;)t.push("0");for(var r=0;r<o;r++){var n=parseInt(e[r]),a=parseInt(t[r]);if(n>a)return 1;if(n<a)return-1}return 0}function V(){return"#"+Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}function W(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8,t=arguments.length>1?arguments[1]:void 0;e=e||32,t||(t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678");for(var o=t.length,r="",n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*o));return r}function X(e){var t,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||f._typeof(e)!=="object")return"";var r=o.addQuestionMark,n=r===void 0?!1:r,a=o.encode,u=a===void 0?!0:a,c=o.arrayFormat,i=c===void 0?"comma":c,s=o.keepEmptyArray,m=s===void 0?!1:s,l=[];function v(h){return u?encodeURIComponent(h):h}var y={indices:function(g,p){p.forEach(function(w,A){l.push("".concat(g,"[").concat(A,"]=").concat(v(w)))})},brackets:function(g,p){p.forEach(function(w){l.push("".concat(g,"[]=").concat(v(w)))})},repeat:function(g,p){p.forEach(function(w){l.push("".concat(g,"=").concat(v(w)))})},comma:function(g,p){var w=p.map(function(A){return v(A)}).join(",");l.push("".concat(g,"=").concat(w))}},P=(t=y[i])!==null&&t!==void 0?t:y.comma;Object.keys(e).forEach(function(h){var g=e[h];if(g!=null){var p=v(h);if(Array.isArray(g)){var w=g.filter(function(S){return S!=null});if(w.length===0){m&&l.push("".concat(p,"="));return}P(p,w);return}var A=g;f._typeof(A)==="object"&&A!==null&&(A=JSON.stringify(A)),l.push("".concat(p,"=").concat(v(A)))}});var d=l.join("&");return n&&d?"?".concat(d):d}function Y(e){var t=decodeURIComponent(e.scene);return t&&(e=f._objectSpread2(f._objectSpread2({fromCode:!0},e),E(t))),e}exports.compareVersion=z;exports.compose=j;exports.composeAsync=I;exports.debounce=F;exports.debouncePromise=G;exports.decodeURIParams=J;exports.encodeURIParams=L;exports.getOnLoadParams=Y;exports.getPascalCase=N;exports.getQueryParams=E;exports.getQueryParamsFromHash=B;exports.getQueryParamsFromSearch=q;exports.getRandom=D;exports.getRandomStr=W;exports.pipe=O;exports.pipeAsync=U;exports.randomColor=V;exports.throttle=H;exports.toQueryString=X;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utils-uniapp",
3
- "version": "1.2.21",
3
+ "version": "1.2.22",
4
4
  "description": "aubyn's utils for uniapp",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",