ddan-js 1.2.2 → 1.2.3
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.
- package/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/index.js +2 -1
- package/bin/lib/modules/math/index.js +14 -1
- package/bin/lib/modules/mini/index.js +13 -13
- package/bin/lib/modules/rule/index.js +53 -0
- package/bin/types/index.d.ts +32 -6
- package/bin/types/modules/math/index.d.ts +2 -0
- package/bin/types/modules/mini/index.d.ts +4 -2
- package/bin/types/modules/rule/index.d.ts +7 -0
- package/bin/types/modules/url/index.d.ts +24 -4
- package/package.json +1 -1
package/bin/ddan-js.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t={gbkLength:function(t){let e=0;if(!t)return 0;for(let n=0;n<t.length;n++)t.charCodeAt(n)>127||94===t.charCodeAt(n)?e+=2:e++;return e},gbkCut:function(t,e){if(!t||e<=0)return"";let n=0,r=0;for(let o=0;o<t.length&&(t.charCodeAt(o)>127||94===t.charCodeAt(o)?n+=2:n++,!(n>e));o++)r=o;return t.substr(0,r+1)}},e="object"==typeof global&&global&&global.Object===Object&&global,n="object"==typeof self&&self&&self.Object===Object&&self,r=e||n||Function("return this")();const o=(t,e="yyyy-MM-dd hh:mm:ss")=>{const n="string"==typeof t||"number"==typeof t?new Date(t):t,r={};return r.yyyy=n.getFullYear(),r.yy=`${r.yyyy}`.substr(2),r.M=n.getMonth()+1,r.MM=(r.M<10?"0":"")+r.M,r.d=n.getDate(),r.dd=(r.d<10?"0":"")+r.d,r.h=n.getHours(),r.hh=(r.h<10?"0":"")+r.h,r.m=n.getMinutes(),r.mm=(r.m<10?"0":"")+r.m,r.s=n.getSeconds(),r.ss=(r.s<10?"0":"")+r.s,r.S=n.getMilliseconds(),r.SS=(r.S<10?"0":"")+r.S,r.SSS=r.S.toString().padStart(3,0),e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(t=>r[t]))};function i(){return r.Date.now()}var s={now:i,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:o,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:i=0,second:s=0}){const c=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${i}:${s}`;return new Date(o(Date.now(),c)).getTime()},todayZero:()=>new Date(o(i(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const c=r.Symbol,{toString:u,hasOwnProperty:a,propertyIsEnumerable:l}=Object.prototype,f=c?c.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){const e=a.call(t,f),n=t[f];let r=!1;try{t[f]=void 0,r=!0}catch(t){}const o=u.call(t);return r&&(e?t[f]=n:delete t[f]),o}(t):u.call(t)}var g={getTag:h,getType:function(t){return(h(t).match(/\w+/g)||["object","Undefined"])[1]||""},toString:u,hasOwnProperty:a,propertyIsEnumerable:l},y="[object Function]",p="[object GeneratorFunction]",d="[object AsyncFunction]",m=9007199254740991;const b=/^(?:0|[1-9]\d*)$/;function v(t){const e=typeof t;return null!=t&&("object"==e||"function"==e)}function j(t){return null!=t&&"object"==typeof t}const O=Array.isArray;function S(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=m}(t.length)&&!A(t)}function w(t){return j(t)&&S(t)}function A(t){var e=v(t)?g.getTag(t):"";return e===y||e===p||e===d}var M={is:function(t,e){return g.getTag(t)===`[object ${e}]`},isNumber:function(t){return"[object Number]"===g.getTag(t)},isString:function(t){return"string"==typeof t||!O(t)&&j(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:j,isSymbol:function(t){return"symbol"==typeof t||j(t)&&"[object Symbol]"===g.getTag(t)},isFunction:A,isArray:O,isArrayLikeObject:w,isIndex:function(t,e){return!!(e=null==e?m:e)&&("number"==typeof t||b.test(t))&&t>-1&&t%1==0&&t<e},isArrayLike:S,isPrototype:function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Object.prototype)},isArguments:function(t){return w(t)&&g.hasOwnProperty.call(t,"callee")&&(!g.propertyIsEnumerable.call(t,"callee")||"[object Arguments]"==g.toString.call(t))},isPromise:function(t){return"[object Promise]"===(v(t)?g.getTag(t):"")}};const $=NaN,T=/^\s+|\s+$/g,k=/^[-+]0x[0-9a-f]+$/i,x=/^0b[01]+$/i,P=/^0o[0-7]+$/i,R=parseInt,D=1/0,I=17976931348623157e292;function F(t){if("number"==typeof t)return t;if(M.isSymbol(t))return $;if(M.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=M.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(T,"");const e=x.test(t);return e||P.test(t)?R(t.slice(2),e?2:8):k.test(t)?$:+t}function C(t){return t?(t=F(t))===D||t===-D?(t<0?-1:1)*I:t==t?t:0:0===t?t:0}var E={toNumber:F,toFinite:C,toInteger:function(t){var e=C(t),n=e%1;return e==e?n?e-n:e:0}};const N="Expected a function",U=Math.max,_=Math.min;function L(t,e=0,n={}){var r,o,i,s,c,u,a=0,l=!1,f=!1,h=!0;if("function"!=typeof t)throw new TypeError(N);function g(e){var n=r,i=o;return r=o=void 0,a=e,s=t.apply(i,n)}function y(t){var n=t-u;return void 0===u||n>=e||n<0||f&&t-a>=i}function p(){var t=Date.now();if(y(t))return d(t);c=setTimeout(p,function(t){var n=e-(t-u);return f?_(n,i-(t-a)):n}(t))}function d(t){return c=void 0,h&&r?g(t):(r=o=void 0,s)}function m(...t){var n=Date.now(),i=y(n);if(r=arguments,o=this,u=n,i){if(void 0===c)return function(t){return a=t,c=setTimeout(p,e),l?g(t):s}(u);if(f)return c=setTimeout(p,e),g(u)}return void 0===c&&(c=setTimeout(p,e)),s}return e=E.toNumber(e)||0,M.isObject(n)&&(l=!!n.leading,i=(f="maxWait"in n)?U(E.toNumber(n.maxWait)||0,e):i,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==c&&clearTimeout(c),a=0,r=u=o=c=void 0},m.flush=function(){return void 0===c?s:d(Date.now())},m}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=M.isFunction(this.source)?this.source():this.source,t=M.isPromise(e)?e:Promise.resolve(e),t.then((t=>[null,t])).catch((t=>[t,void 0]))}catch(t){return Promise.resolve([t,void 0])}}}var W={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:L,throttle:function(t,e=0,n={}){var r=!1,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return M.isObject(n)&&(r=n.leading?!!n.leading:r,o=n.trailing?!!n.trailing:o),L(t,e,{leading:r,maxWait:e,trailing:o})}};var q={random:function(t){return Math.floor(Math.random()*t)},randomRange:function(t,e){return Math.floor(Math.random()*(e-t+1)+t)},lerp:function(t,e,n){return t*(1-n)+e*n}};function H(t){return t!=t}function J(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}(e,(function(e){return t[e]}))}var G,Y,Z=(G=Object.keys,Y=Object,function(t){return G(Y(t))}),z=Math.max;function K(t,e){var n=M.isArray(t)||M.isArguments(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var i in t)!e&&!g.hasOwnProperty.call(t,i)||o&&("length"==i||M.isIndex(i,r))||n.push(i);return n}var Q=Object.assign(Object.assign(Object.assign({},M),g),{includes:function(t,e,n,r){var o;t=M.isArrayLike(t)?t:(o=t)?J(o,function(t){return M.isArrayLike(t)?K(t):function(t){if(!M.isPrototype(t))return Z(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(o)):[],n=n&&!r?E.toInteger(n):0;var i=t.length;return n<0&&(n=z(i+n,0)),M.isString(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,H,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n)>-1}});class V{constructor(){this._map=new Map}clear(){return this._map.clear(),this}on(t,e){if(!e)return this;let n=this._map.get(t);return n||(n=new Set,this._map.set(t,n)),n.add(e),this}emit(t,...e){const n=this._map.get(t);if(!n)return this;return[...n].forEach((t=>t(...e))),this}off(t="",e){if(!t)return this._map.clear(),this;if(!e)return this._map.delete(t.toString()),this;const n=this._map.get(t);return n?(n.delete(e),this):this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}has(t){return this._map.has(t)}}var X={groupBy:(t,e)=>t.reduce(((t,n)=>((t[n[e]]=t[n[e]]||[]).push(n),t)),{}),stepAction:function(t,e,n=100){if(!M.isFunction(e))return;if(!M.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let o=n+r,i=t.slice(r,o);e&&e(i),r=o}},skip:(t,e)=>{if(!M.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!M.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const o=e+r;return t.slice(r,t.length<o?t.length:o)||[]},distinct:t=>!M.isArray(t)||t.length<=0?[]:[...new Set(t)]};const tt="[object Object]",et="[object Array]",nt=t=>Object.prototype.toString.call(t),rt=(t,e,n=!1)=>{if(t===e)return;const r=nt(t);if(r===nt(e))if(r===et&&t.length>=e.length)for(let n=0;n<e.length;n++)rt(t[n],e[n]);else if(r===tt&&Object.keys(t).length>=Object.keys(e).length)for(let r in e)n||void 0!==t[r]?rt(t[r],e[r]):t[r]=null},ot=(t,e,n,r="",o=!1)=>{if(t===e)return;const i=nt(t),s=nt(e);if(i===et&&s===i&&t.length>=e.length)for(let o=0;o<t.length;o++)ot(t[o],e[o],n,`${r}[${o}]`);else if(i===tt&&s===i&&(o||Object.keys(t).length>=Object.keys(e).length)){const o=Object.keys(t);for(let i of o){const o=t[i],s=e[i],c=nt(o),u=nt(s);if(o!==s)if(c===et&&u===c&&o.length>=s.length)for(let t=0;t<o.length;t++)ot(o[t],s[t],n,`${r?r+".":""}${i}[${t}]`);else if(c===tt&&u===c&&Object.keys(o).length>=Object.keys(s).length)for(let t in o)ot(o[t],s[t],n,`${r?r+".":""}${i}.${t}`);else n[`${r?r+".":""}${i}`]=o}}else n[r]=t};const it=t=>(e,...n)=>new Promise(((r,o)=>{t(Object.assign({},e,{success:r,fail:o}),...n)}));var st={diff:function(t,e){const n={};return(t=>{if(nt(t)===tt)for(let e in t)if(/\w+\.\w+/g.test(e)&&-1===e.indexOf("[")){const n=e.split(".");let r=t,o=n.length;for(let t=0;t<o-1;t++){const e=n[t];nt(r[e])!==tt&&(r[e]={}),r=r[e]}r[n[o-1]]=t[e],delete t[e]}})(t),rt(t,e,!0),ot(t,e,n,"",!0),n},promixify:it,api:(t,e=null,...n)=>W.run(it(t)(e,...n))};function ct(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const ut=function(t,{sep:e="&",eq:n="=",max:r=1e3,multiple:o=!1}={}){e=e||"&",n=n||"=";const i={};if("string"!=typeof t||0===t.length)return i;const s=/\+/g,c=r||1e3;let u=(t=t.split(e)).length;c>0&&u>c&&(u=c);for(let e=0;e<u;++e){let r,c,u,a,l=t[e].replace(s,"%20"),f=l.indexOf(n);f>=0?(r=l.substr(0,f),c=l.substr(f+1)):(r=l,c=""),u=decodeURIComponent(r),a=decodeURIComponent(c),ct(i,u)&&o?Array.isArray(i[u])?i[u].push(a):i[u]=[i[u],a]:i[u]=a}return i},at=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},lt=function(t,{sep:e="&",eq:n="=",name:r=null,multiple:o=!1}={}){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){const i=encodeURIComponent(at(r))+n;return o&&Array.isArray(t[r])?t[r].map((function(t){return i+encodeURIComponent(at(t))})).join(e):i+encodeURIComponent(at(t[r]))})).filter(Boolean).join(e):r?encodeURIComponent(at(r))+n+encodeURIComponent(at(t)):""};var ft={parse:ut,decode:ut,stringify:lt,encode:lt};function ht(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function c(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,c)}u((r=r.apply(t,e||[])).next())}))}class gt extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return ht(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!M.isFunction(n))return;const[,r]=yield W.run(n(this,e));return r}))}getByOnce(t){return ht(this,void 0,void 0,(function*(){const e=Reflect.get(this,t);let n;return n=null!=e&&""!==e?JSON.parse(JSON.stringify(e)):yield this.dispatch(t),n}))}}var yt={gbk:t,time:s,hook:W,math:q,util:Q,list:X,mini:st,url:ft,DEvent:V,store:gt,storeRef:t=>{const e=Object.assign(new gt,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return M.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const o=Reflect.get(t.setters,e);if(M.isFunction(o)&&!o(n))return!0;const i=Reflect.set(t,e,n,r);return i&&t.emit(e.toString(),n),i},has:(t,e)=>Reflect.has(t,e)})}};export{yt as default};
|
|
1
|
+
var t={gbkLength:function(t){let e=0;if(!t)return 0;for(let n=0;n<t.length;n++)t.charCodeAt(n)>127||94===t.charCodeAt(n)?e+=2:e++;return e},gbkCut:function(t,e){if(!t||e<=0)return"";let n=0,r=0;for(let o=0;o<t.length&&(t.charCodeAt(o)>127||94===t.charCodeAt(o)?n+=2:n++,!(n>e));o++)r=o;return t.substr(0,r+1)}},e="object"==typeof global&&global&&global.Object===Object&&global,n="object"==typeof self&&self&&self.Object===Object&&self,r=e||n||Function("return this")();const o=(t,e="yyyy-MM-dd hh:mm:ss")=>{const n="string"==typeof t||"number"==typeof t?new Date(t):t,r={};return r.yyyy=n.getFullYear(),r.yy=`${r.yyyy}`.substr(2),r.M=n.getMonth()+1,r.MM=(r.M<10?"0":"")+r.M,r.d=n.getDate(),r.dd=(r.d<10?"0":"")+r.d,r.h=n.getHours(),r.hh=(r.h<10?"0":"")+r.h,r.m=n.getMinutes(),r.mm=(r.m<10?"0":"")+r.m,r.s=n.getSeconds(),r.ss=(r.s<10?"0":"")+r.s,r.S=n.getMilliseconds(),r.SS=(r.S<10?"0":"")+r.S,r.SSS=r.S.toString().padStart(3,0),e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(t=>r[t]))};function i(){return r.Date.now()}var s={now:i,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:o,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:i=0,second:s=0}){const u=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${i}:${s}`;return new Date(o(Date.now(),u)).getTime()},todayZero:()=>new Date(o(i(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const u=r.Symbol,{toString:c,hasOwnProperty:a,propertyIsEnumerable:l}=Object.prototype,f=u?u.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){const e=a.call(t,f),n=t[f];let r=!1;try{t[f]=void 0,r=!0}catch(t){}const o=c.call(t);return r&&(e?t[f]=n:delete t[f]),o}(t):c.call(t)}var g={getTag:h,getType:function(t){return(h(t).match(/\w+/g)||["object","Undefined"])[1]||""},toString:c,hasOwnProperty:a,propertyIsEnumerable:l},y="[object Function]",d="[object GeneratorFunction]",p="[object AsyncFunction]",m=9007199254740991;const b=/^(?:0|[1-9]\d*)$/;function v(t){const e=typeof t;return null!=t&&("object"==e||"function"==e)}function j(t){return null!=t&&"object"==typeof t}const O=Array.isArray;function S(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=m}(t.length)&&!A(t)}function w(t){return j(t)&&S(t)}function A(t){var e=v(t)?g.getTag(t):"";return e===y||e===d||e===p}var M={is:function(t,e){return g.getTag(t)===`[object ${e}]`},isNumber:function(t){return"[object Number]"===g.getTag(t)},isString:function(t){return"string"==typeof t||!O(t)&&j(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:j,isSymbol:function(t){return"symbol"==typeof t||j(t)&&"[object Symbol]"===g.getTag(t)},isFunction:A,isArray:O,isArrayLikeObject:w,isIndex:function(t,e){return!!(e=null==e?m:e)&&("number"==typeof t||b.test(t))&&t>-1&&t%1==0&&t<e},isArrayLike:S,isPrototype:function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Object.prototype)},isArguments:function(t){return w(t)&&g.hasOwnProperty.call(t,"callee")&&(!g.propertyIsEnumerable.call(t,"callee")||"[object Arguments]"==g.toString.call(t))},isPromise:function(t){return"[object Promise]"===(v(t)?g.getTag(t):"")}};const $=NaN,T=/^\s+|\s+$/g,k=/^[-+]0x[0-9a-f]+$/i,x=/^0b[01]+$/i,P=/^0o[0-7]+$/i,D=parseInt,I=1/0,R=17976931348623157e292;function F(t){if("number"==typeof t)return t;if(M.isSymbol(t))return $;if(M.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=M.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(T,"");const e=x.test(t);return e||P.test(t)?D(t.slice(2),e?2:8):k.test(t)?$:+t}function C(t){return t?(t=F(t))===I||t===-I?(t<0?-1:1)*R:t==t?t:0:0===t?t:0}var E={toNumber:F,toFinite:C,toInteger:function(t){var e=C(t),n=e%1;return e==e?n?e-n:e:0}};const N="Expected a function",U=Math.max,_=Math.min;function L(t,e=0,n={}){var r,o,i,s,u,c,a=0,l=!1,f=!1,h=!0;if("function"!=typeof t)throw new TypeError(N);function g(e){var n=r,i=o;return r=o=void 0,a=e,s=t.apply(i,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||f&&t-a>=i}function d(){var t=Date.now();if(y(t))return p(t);u=setTimeout(d,function(t){var n=e-(t-c);return f?_(n,i-(t-a)):n}(t))}function p(t){return u=void 0,h&&r?g(t):(r=o=void 0,s)}function m(...t){var n=Date.now(),i=y(n);if(r=arguments,o=this,c=n,i){if(void 0===u)return function(t){return a=t,u=setTimeout(d,e),l?g(t):s}(c);if(f)return u=setTimeout(d,e),g(c)}return void 0===u&&(u=setTimeout(d,e)),s}return e=E.toNumber(e)||0,M.isObject(n)&&(l=!!n.leading,i=(f="maxWait"in n)?U(E.toNumber(n.maxWait)||0,e):i,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==u&&clearTimeout(u),a=0,r=c=o=u=void 0},m.flush=function(){return void 0===u?s:p(Date.now())},m}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=M.isFunction(this.source)?this.source():this.source,t=M.isPromise(e)?e:Promise.resolve(e),t.then((t=>[null,t])).catch((t=>[t,void 0]))}catch(t){return Promise.resolve([t,void 0])}}}var W={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:L,throttle:function(t,e=0,n={}){var r=!1,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return M.isObject(n)&&(r=n.leading?!!n.leading:r,o=n.trailing?!!n.trailing:o),L(t,e,{leading:r,maxWait:e,trailing:o})}};var q={random:function(t){return Math.floor(Math.random()*t)},randomRange:function(t,e){return Math.floor(Math.random()*(e-t+1)+t)},lerp:function(t,e,n){return t*(1-n)+e*n},randomString:function(t,e=!1){t=t||32;const n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let r="";for(let e=0;e<t;e++)r+=n.charAt(Math.floor(62*Math.random()));return e?s.format(new Date,"yyyyMMddhhmmss")+r:r}};function H(t){return t!=t}function J(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}(e,(function(e){return t[e]}))}var Z,z,G=(Z=Object.keys,z=Object,function(t){return Z(z(t))}),Y=Math.max;function K(t,e){var n=M.isArray(t)||M.isArguments(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var i in t)!e&&!g.hasOwnProperty.call(t,i)||o&&("length"==i||M.isIndex(i,r))||n.push(i);return n}var Q=Object.assign(Object.assign(Object.assign({},M),g),{includes:function(t,e,n,r){var o;t=M.isArrayLike(t)?t:(o=t)?J(o,function(t){return M.isArrayLike(t)?K(t):function(t){if(!M.isPrototype(t))return G(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(o)):[],n=n&&!r?E.toInteger(n):0;var i=t.length;return n<0&&(n=Y(i+n,0)),M.isString(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,H,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n)>-1}});class V{constructor(){this._map=new Map}clear(){return this._map.clear(),this}on(t,e){if(!e)return this;let n=this._map.get(t);return n||(n=new Set,this._map.set(t,n)),n.add(e),this}emit(t,...e){const n=this._map.get(t);if(!n)return this;return[...n].forEach((t=>t(...e))),this}off(t="",e){if(!t)return this._map.clear(),this;if(!e)return this._map.delete(t.toString()),this;const n=this._map.get(t);return n?(n.delete(e),this):this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}has(t){return this._map.has(t)}}var X={groupBy:(t,e)=>t.reduce(((t,n)=>((t[n[e]]=t[n[e]]||[]).push(n),t)),{}),stepAction:function(t,e,n=100){if(!M.isFunction(e))return;if(!M.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let o=n+r,i=t.slice(r,o);e&&e(i),r=o}},skip:(t,e)=>{if(!M.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!M.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const o=e+r;return t.slice(r,t.length<o?t.length:o)||[]},distinct:t=>!M.isArray(t)||t.length<=0?[]:[...new Set(t)]};const tt="[object Object]",et="[object Array]",nt=t=>Object.prototype.toString.call(t),rt=(t,e,n=!1)=>{if(t===e)return;const r=nt(t);if(r===nt(e))if(r===et&&t.length>=e.length)for(let n=0;n<e.length;n++)rt(t[n],e[n]);else if(r===tt&&Object.keys(t).length>=Object.keys(e).length)for(let r in e)n||void 0!==t[r]?rt(t[r],e[r]):t[r]=null},ot=(t,e,n,r="",o=!1)=>{if(t===e)return;const i=nt(t),s=nt(e);if(i===et&&s===i&&t.length>=e.length)for(let o=0;o<t.length;o++)ot(t[o],e[o],n,`${r}[${o}]`);else if(i===tt&&s===i&&(o||Object.keys(t).length>=Object.keys(e).length)){const o=Object.keys(t);for(let i of o){const o=t[i],s=e[i],u=nt(o),c=nt(s);if(o!==s)if(u===et&&c===u&&o.length>=s.length)for(let t=0;t<o.length;t++)ot(o[t],s[t],n,`${r?r+".":""}${i}[${t}]`);else if(u===tt&&c===u&&Object.keys(o).length>=Object.keys(s).length)for(let t in o)ot(o[t],s[t],n,`${r?r+".":""}${i}.${t}`);else n[`${r?r+".":""}${i}`]=o}}else n[r]=t};const it=t=>"function"!=typeof t?t:(e={})=>new Promise(((n,r)=>{t(Object.assign(e,{success:n,fail:r}))}));var st={diff:function(t,e){const n={};return(t=>{if(nt(t)===tt)for(let e in t)if(/\w+\.\w+/g.test(e)&&-1===e.indexOf("[")){const n=e.split(".");let r=t,o=n.length;for(let t=0;t<o-1;t++){const e=n[t];nt(r[e])!==tt&&(r[e]={}),r=r[e]}r[n[o-1]]=t[e],delete t[e]}})(t),rt(t,e,!0),ot(t,e,n,"",!0),n},promixify:it,run:(t,e={})=>{if(t)return W.run(it(t)(e))},formatList:function(t,e,n){return(t||[]).reduce(((t,r,o)=>Object.assign(Object.assign({},t),{[`${n}[${e+o}]`]:r})),{})}};function ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const ct=function(t,{sep:e="&",eq:n="=",max:r=1e3,multiple:o=!1}={}){e=e||"&",n=n||"=";const i={};if("string"!=typeof t||0===t.length)return i;const s=/\+/g,u=r||1e3;let c=(t=t.split(e)).length;u>0&&c>u&&(c=u);for(let e=0;e<c;++e){let r,u,c,a,l=t[e].replace(s,"%20"),f=l.indexOf(n);f>=0?(r=l.substr(0,f),u=l.substr(f+1)):(r=l,u=""),c=decodeURIComponent(r),a=decodeURIComponent(u),ut(i,c)&&o?Array.isArray(i[c])?i[c].push(a):i[c]=[i[c],a]:i[c]=a}return i},at=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},lt=function(t,{sep:e="&",eq:n="=",name:r=null,multiple:o=!1}={}){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){const i=encodeURIComponent(at(r))+n;return o&&Array.isArray(t[r])?t[r].map((function(t){return i+encodeURIComponent(at(t))})).join(e):i+encodeURIComponent(at(t[r]))})).filter(Boolean).join(e):r?encodeURIComponent(at(r))+n+encodeURIComponent(at(t)):""};var ft={parse:ct,decode:ct,stringify:lt,encode:lt};var ht={validateId:function(t){return!!t&&(!(t.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(t))},validatePhone:function(t){return!!t&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(t)}};function gt(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))}class yt extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return gt(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!M.isFunction(n))return;const[,r]=yield W.run(n(this,e));return r}))}getByOnce(t){return gt(this,void 0,void 0,(function*(){const e=Reflect.get(this,t);let n;return n=null!=e&&""!==e?JSON.parse(JSON.stringify(e)):yield this.dispatch(t),n}))}}var dt={gbk:t,time:s,hook:W,math:q,util:Q,list:X,mini:st,url:ft,rule:ht,DEvent:V,store:yt,storeRef:t=>{const e=Object.assign(new yt,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return M.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const o=Reflect.get(t.setters,e);if(M.isFunction(o)&&!o(n))return!0;const i=Reflect.set(t,e,n,r);return i&&t.emit(e.toString(),n),i},has:(t,e)=>Reflect.has(t,e)})}};export{dt as default};
|
package/bin/ddan-js.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ddan=e()}(this,(function(){"use strict";var t={gbkLength:function(t){let e=0;if(!t)return 0;for(let n=0;n<t.length;n++)t.charCodeAt(n)>127||94===t.charCodeAt(n)?e+=2:e++;return e},gbkCut:function(t,e){if(!t||e<=0)return"";let n=0,r=0;for(let o=0;o<t.length&&(t.charCodeAt(o)>127||94===t.charCodeAt(o)?n+=2:n++,!(n>e));o++)r=o;return t.substr(0,r+1)}},e="object"==typeof global&&global&&global.Object===Object&&global,n="object"==typeof self&&self&&self.Object===Object&&self,r=e||n||Function("return this")();const o=(t,e="yyyy-MM-dd hh:mm:ss")=>{const n="string"==typeof t||"number"==typeof t?new Date(t):t,r={};return r.yyyy=n.getFullYear(),r.yy=`${r.yyyy}`.substr(2),r.M=n.getMonth()+1,r.MM=(r.M<10?"0":"")+r.M,r.d=n.getDate(),r.dd=(r.d<10?"0":"")+r.d,r.h=n.getHours(),r.hh=(r.h<10?"0":"")+r.h,r.m=n.getMinutes(),r.mm=(r.m<10?"0":"")+r.m,r.s=n.getSeconds(),r.ss=(r.s<10?"0":"")+r.s,r.S=n.getMilliseconds(),r.SS=(r.S<10?"0":"")+r.S,r.SSS=r.S.toString().padStart(3,0),e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(t=>r[t]))};function i(){return r.Date.now()}var s={now:i,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:o,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:i=0,second:s=0}){const u=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${i}:${s}`;return new Date(o(Date.now(),u)).getTime()},todayZero:()=>new Date(o(i(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const u=r.Symbol,{toString:c,hasOwnProperty:a,propertyIsEnumerable:l}=Object.prototype,f=u?u.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){const e=a.call(t,f),n=t[f];let r=!1;try{t[f]=void 0,r=!0}catch(t){}const o=c.call(t);return r&&(e?t[f]=n:delete t[f]),o}(t):c.call(t)}var g={getTag:h,getType:function(t){return(h(t).match(/\w+/g)||["object","Undefined"])[1]||""},toString:c,hasOwnProperty:a,propertyIsEnumerable:l},y="[object Function]",d="[object GeneratorFunction]",p="[object AsyncFunction]",m=9007199254740991;const b=/^(?:0|[1-9]\d*)$/;function v(t){const e=typeof t;return null!=t&&("object"==e||"function"==e)}function j(t){return null!=t&&"object"==typeof t}const O=Array.isArray;function S(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=m}(t.length)&&!A(t)}function w(t){return j(t)&&S(t)}function A(t){var e=v(t)?g.getTag(t):"";return e===y||e===d||e===p}var M={is:function(t,e){return g.getTag(t)===`[object ${e}]`},isNumber:function(t){return"[object Number]"===g.getTag(t)},isString:function(t){return"string"==typeof t||!O(t)&&j(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:j,isSymbol:function(t){return"symbol"==typeof t||j(t)&&"[object Symbol]"===g.getTag(t)},isFunction:A,isArray:O,isArrayLikeObject:w,isIndex:function(t,e){return!!(e=null==e?m:e)&&("number"==typeof t||b.test(t))&&t>-1&&t%1==0&&t<e},isArrayLike:S,isPrototype:function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Object.prototype)},isArguments:function(t){return w(t)&&g.hasOwnProperty.call(t,"callee")&&(!g.propertyIsEnumerable.call(t,"callee")||"[object Arguments]"==g.toString.call(t))},isPromise:function(t){return"[object Promise]"===(v(t)?g.getTag(t):"")}};const $=NaN,T=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,P=/^0o[0-7]+$/i,R=parseInt,D=1/0,I=17976931348623157e292;function F(t){if("number"==typeof t)return t;if(M.isSymbol(t))return $;if(M.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=M.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(T,"");const e=k.test(t);return e||P.test(t)?R(t.slice(2),e?2:8):x.test(t)?$:+t}function C(t){return t?(t=F(t))===D||t===-D?(t<0?-1:1)*I:t==t?t:0:0===t?t:0}var E={toNumber:F,toFinite:C,toInteger:function(t){var e=C(t),n=e%1;return e==e?n?e-n:e:0}};const N="Expected a function",U=Math.max,_=Math.min;function L(t,e=0,n={}){var r,o,i,s,u,c,a=0,l=!1,f=!1,h=!0;if("function"!=typeof t)throw new TypeError(N);function g(e){var n=r,i=o;return r=o=void 0,a=e,s=t.apply(i,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||f&&t-a>=i}function d(){var t=Date.now();if(y(t))return p(t);u=setTimeout(d,function(t){var n=e-(t-c);return f?_(n,i-(t-a)):n}(t))}function p(t){return u=void 0,h&&r?g(t):(r=o=void 0,s)}function m(...t){var n=Date.now(),i=y(n);if(r=arguments,o=this,c=n,i){if(void 0===u)return function(t){return a=t,u=setTimeout(d,e),l?g(t):s}(c);if(f)return u=setTimeout(d,e),g(c)}return void 0===u&&(u=setTimeout(d,e)),s}return e=E.toNumber(e)||0,M.isObject(n)&&(l=!!n.leading,i=(f="maxWait"in n)?U(E.toNumber(n.maxWait)||0,e):i,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==u&&clearTimeout(u),a=0,r=c=o=u=void 0},m.flush=function(){return void 0===u?s:p(Date.now())},m}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=M.isFunction(this.source)?this.source():this.source,t=M.isPromise(e)?e:Promise.resolve(e),t.then((t=>[null,t])).catch((t=>[t,void 0]))}catch(t){return Promise.resolve([t,void 0])}}}var W={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:L,throttle:function(t,e=0,n={}){var r=!1,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return M.isObject(n)&&(r=n.leading?!!n.leading:r,o=n.trailing?!!n.trailing:o),L(t,e,{leading:r,maxWait:e,trailing:o})}};var q={random:function(t){return Math.floor(Math.random()*t)},randomRange:function(t,e){return Math.floor(Math.random()*(e-t+1)+t)},lerp:function(t,e,n){return t*(1-n)+e*n}};function H(t){return t!=t}function J(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}(e,(function(e){return t[e]}))}var G,Y,Z=(G=Object.keys,Y=Object,function(t){return G(Y(t))}),z=Math.max;function K(t,e){var n=M.isArray(t)||M.isArguments(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var i in t)!e&&!g.hasOwnProperty.call(t,i)||o&&("length"==i||M.isIndex(i,r))||n.push(i);return n}var Q=Object.assign(Object.assign(Object.assign({},M),g),{includes:function(t,e,n,r){var o;t=M.isArrayLike(t)?t:(o=t)?J(o,function(t){return M.isArrayLike(t)?K(t):function(t){if(!M.isPrototype(t))return Z(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(o)):[],n=n&&!r?E.toInteger(n):0;var i=t.length;return n<0&&(n=z(i+n,0)),M.isString(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,H,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n)>-1}});class V{constructor(){this._map=new Map}clear(){return this._map.clear(),this}on(t,e){if(!e)return this;let n=this._map.get(t);return n||(n=new Set,this._map.set(t,n)),n.add(e),this}emit(t,...e){const n=this._map.get(t);if(!n)return this;return[...n].forEach((t=>t(...e))),this}off(t="",e){if(!t)return this._map.clear(),this;if(!e)return this._map.delete(t.toString()),this;const n=this._map.get(t);return n?(n.delete(e),this):this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}has(t){return this._map.has(t)}}var X={groupBy:(t,e)=>t.reduce(((t,n)=>((t[n[e]]=t[n[e]]||[]).push(n),t)),{}),stepAction:function(t,e,n=100){if(!M.isFunction(e))return;if(!M.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let o=n+r,i=t.slice(r,o);e&&e(i),r=o}},skip:(t,e)=>{if(!M.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!M.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const o=e+r;return t.slice(r,t.length<o?t.length:o)||[]},distinct:t=>!M.isArray(t)||t.length<=0?[]:[...new Set(t)]};const tt="[object Object]",et="[object Array]",nt=t=>Object.prototype.toString.call(t),rt=(t,e,n=!1)=>{if(t===e)return;const r=nt(t);if(r===nt(e))if(r===et&&t.length>=e.length)for(let n=0;n<e.length;n++)rt(t[n],e[n]);else if(r===tt&&Object.keys(t).length>=Object.keys(e).length)for(let r in e)n||void 0!==t[r]?rt(t[r],e[r]):t[r]=null},ot=(t,e,n,r="",o=!1)=>{if(t===e)return;const i=nt(t),s=nt(e);if(i===et&&s===i&&t.length>=e.length)for(let o=0;o<t.length;o++)ot(t[o],e[o],n,`${r}[${o}]`);else if(i===tt&&s===i&&(o||Object.keys(t).length>=Object.keys(e).length)){const o=Object.keys(t);for(let i of o){const o=t[i],s=e[i],u=nt(o),c=nt(s);if(o!==s)if(u===et&&c===u&&o.length>=s.length)for(let t=0;t<o.length;t++)ot(o[t],s[t],n,`${r?r+".":""}${i}[${t}]`);else if(u===tt&&c===u&&Object.keys(o).length>=Object.keys(s).length)for(let t in o)ot(o[t],s[t],n,`${r?r+".":""}${i}.${t}`);else n[`${r?r+".":""}${i}`]=o}}else n[r]=t};const it=t=>(e,...n)=>new Promise(((r,o)=>{t(Object.assign({},e,{success:r,fail:o}),...n)}));var st={diff:function(t,e){const n={};return(t=>{if(nt(t)===tt)for(let e in t)if(/\w+\.\w+/g.test(e)&&-1===e.indexOf("[")){const n=e.split(".");let r=t,o=n.length;for(let t=0;t<o-1;t++){const e=n[t];nt(r[e])!==tt&&(r[e]={}),r=r[e]}r[n[o-1]]=t[e],delete t[e]}})(t),rt(t,e,!0),ot(t,e,n,"",!0),n},promixify:it,api:(t,e=null,...n)=>W.run(it(t)(e,...n))};function ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const ct=function(t,{sep:e="&",eq:n="=",max:r=1e3,multiple:o=!1}={}){e=e||"&",n=n||"=";const i={};if("string"!=typeof t||0===t.length)return i;const s=/\+/g,u=r||1e3;let c=(t=t.split(e)).length;u>0&&c>u&&(c=u);for(let e=0;e<c;++e){let r,u,c,a,l=t[e].replace(s,"%20"),f=l.indexOf(n);f>=0?(r=l.substr(0,f),u=l.substr(f+1)):(r=l,u=""),c=decodeURIComponent(r),a=decodeURIComponent(u),ut(i,c)&&o?Array.isArray(i[c])?i[c].push(a):i[c]=[i[c],a]:i[c]=a}return i},at=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},lt=function(t,{sep:e="&",eq:n="=",name:r=null,multiple:o=!1}={}){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){const i=encodeURIComponent(at(r))+n;return o&&Array.isArray(t[r])?t[r].map((function(t){return i+encodeURIComponent(at(t))})).join(e):i+encodeURIComponent(at(t[r]))})).filter(Boolean).join(e):r?encodeURIComponent(at(r))+n+encodeURIComponent(at(t)):""};var ft={parse:ct,decode:ct,stringify:lt,encode:lt};function ht(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))}class gt extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return ht(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!M.isFunction(n))return;const[,r]=yield W.run(n(this,e));return r}))}getByOnce(t){return ht(this,void 0,void 0,(function*(){const e=Reflect.get(this,t);let n;return n=null!=e&&""!==e?JSON.parse(JSON.stringify(e)):yield this.dispatch(t),n}))}}return{gbk:t,time:s,hook:W,math:q,util:Q,list:X,mini:st,url:ft,DEvent:V,store:gt,storeRef:t=>{const e=Object.assign(new gt,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return M.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const o=Reflect.get(t.setters,e);if(M.isFunction(o)&&!o(n))return!0;const i=Reflect.set(t,e,n,r);return i&&t.emit(e.toString(),n),i},has:(t,e)=>Reflect.has(t,e)})}}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ddan=e()}(this,(function(){"use strict";var t={gbkLength:function(t){let e=0;if(!t)return 0;for(let n=0;n<t.length;n++)t.charCodeAt(n)>127||94===t.charCodeAt(n)?e+=2:e++;return e},gbkCut:function(t,e){if(!t||e<=0)return"";let n=0,r=0;for(let o=0;o<t.length&&(t.charCodeAt(o)>127||94===t.charCodeAt(o)?n+=2:n++,!(n>e));o++)r=o;return t.substr(0,r+1)}},e="object"==typeof global&&global&&global.Object===Object&&global,n="object"==typeof self&&self&&self.Object===Object&&self,r=e||n||Function("return this")();const o=(t,e="yyyy-MM-dd hh:mm:ss")=>{const n="string"==typeof t||"number"==typeof t?new Date(t):t,r={};return r.yyyy=n.getFullYear(),r.yy=`${r.yyyy}`.substr(2),r.M=n.getMonth()+1,r.MM=(r.M<10?"0":"")+r.M,r.d=n.getDate(),r.dd=(r.d<10?"0":"")+r.d,r.h=n.getHours(),r.hh=(r.h<10?"0":"")+r.h,r.m=n.getMinutes(),r.mm=(r.m<10?"0":"")+r.m,r.s=n.getSeconds(),r.ss=(r.s<10?"0":"")+r.s,r.S=n.getMilliseconds(),r.SS=(r.S<10?"0":"")+r.S,r.SSS=r.S.toString().padStart(3,0),e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(t=>r[t]))};function i(){return r.Date.now()}var s={now:i,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:o,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:i=0,second:s=0}){const u=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${i}:${s}`;return new Date(o(Date.now(),u)).getTime()},todayZero:()=>new Date(o(i(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const u=r.Symbol,{toString:c,hasOwnProperty:a,propertyIsEnumerable:f}=Object.prototype,l=u?u.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":l&&l in Object(t)?function(t){const e=a.call(t,l),n=t[l];let r=!1;try{t[l]=void 0,r=!0}catch(t){}const o=c.call(t);return r&&(e?t[l]=n:delete t[l]),o}(t):c.call(t)}var g={getTag:h,getType:function(t){return(h(t).match(/\w+/g)||["object","Undefined"])[1]||""},toString:c,hasOwnProperty:a,propertyIsEnumerable:f},y="[object Function]",d="[object GeneratorFunction]",p="[object AsyncFunction]",m=9007199254740991;const b=/^(?:0|[1-9]\d*)$/;function v(t){const e=typeof t;return null!=t&&("object"==e||"function"==e)}function j(t){return null!=t&&"object"==typeof t}const O=Array.isArray;function S(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=m}(t.length)&&!A(t)}function w(t){return j(t)&&S(t)}function A(t){var e=v(t)?g.getTag(t):"";return e===y||e===d||e===p}var M={is:function(t,e){return g.getTag(t)===`[object ${e}]`},isNumber:function(t){return"[object Number]"===g.getTag(t)},isString:function(t){return"string"==typeof t||!O(t)&&j(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:j,isSymbol:function(t){return"symbol"==typeof t||j(t)&&"[object Symbol]"===g.getTag(t)},isFunction:A,isArray:O,isArrayLikeObject:w,isIndex:function(t,e){return!!(e=null==e?m:e)&&("number"==typeof t||b.test(t))&&t>-1&&t%1==0&&t<e},isArrayLike:S,isPrototype:function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Object.prototype)},isArguments:function(t){return w(t)&&g.hasOwnProperty.call(t,"callee")&&(!g.propertyIsEnumerable.call(t,"callee")||"[object Arguments]"==g.toString.call(t))},isPromise:function(t){return"[object Promise]"===(v(t)?g.getTag(t):"")}};const $=NaN,T=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,P=/^0o[0-7]+$/i,D=parseInt,I=1/0,R=17976931348623157e292;function F(t){if("number"==typeof t)return t;if(M.isSymbol(t))return $;if(M.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=M.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(T,"");const e=k.test(t);return e||P.test(t)?D(t.slice(2),e?2:8):x.test(t)?$:+t}function C(t){return t?(t=F(t))===I||t===-I?(t<0?-1:1)*R:t==t?t:0:0===t?t:0}var E={toNumber:F,toFinite:C,toInteger:function(t){var e=C(t),n=e%1;return e==e?n?e-n:e:0}};const N="Expected a function",U=Math.max,_=Math.min;function L(t,e=0,n={}){var r,o,i,s,u,c,a=0,f=!1,l=!1,h=!0;if("function"!=typeof t)throw new TypeError(N);function g(e){var n=r,i=o;return r=o=void 0,a=e,s=t.apply(i,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||l&&t-a>=i}function d(){var t=Date.now();if(y(t))return p(t);u=setTimeout(d,function(t){var n=e-(t-c);return l?_(n,i-(t-a)):n}(t))}function p(t){return u=void 0,h&&r?g(t):(r=o=void 0,s)}function m(...t){var n=Date.now(),i=y(n);if(r=arguments,o=this,c=n,i){if(void 0===u)return function(t){return a=t,u=setTimeout(d,e),f?g(t):s}(c);if(l)return u=setTimeout(d,e),g(c)}return void 0===u&&(u=setTimeout(d,e)),s}return e=E.toNumber(e)||0,M.isObject(n)&&(f=!!n.leading,i=(l="maxWait"in n)?U(E.toNumber(n.maxWait)||0,e):i,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==u&&clearTimeout(u),a=0,r=c=o=u=void 0},m.flush=function(){return void 0===u?s:p(Date.now())},m}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=M.isFunction(this.source)?this.source():this.source,t=M.isPromise(e)?e:Promise.resolve(e),t.then((t=>[null,t])).catch((t=>[t,void 0]))}catch(t){return Promise.resolve([t,void 0])}}}var W={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:L,throttle:function(t,e=0,n={}){var r=!1,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return M.isObject(n)&&(r=n.leading?!!n.leading:r,o=n.trailing?!!n.trailing:o),L(t,e,{leading:r,maxWait:e,trailing:o})}};var q={random:function(t){return Math.floor(Math.random()*t)},randomRange:function(t,e){return Math.floor(Math.random()*(e-t+1)+t)},lerp:function(t,e,n){return t*(1-n)+e*n},randomString:function(t,e=!1){t=t||32;const n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let r="";for(let e=0;e<t;e++)r+=n.charAt(Math.floor(62*Math.random()));return e?s.format(new Date,"yyyyMMddhhmmss")+r:r}};function H(t){return t!=t}function J(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}(e,(function(e){return t[e]}))}var Z,z,G=(Z=Object.keys,z=Object,function(t){return Z(z(t))}),Y=Math.max;function K(t,e){var n=M.isArray(t)||M.isArguments(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var i in t)!e&&!g.hasOwnProperty.call(t,i)||o&&("length"==i||M.isIndex(i,r))||n.push(i);return n}var Q=Object.assign(Object.assign(Object.assign({},M),g),{includes:function(t,e,n,r){var o;t=M.isArrayLike(t)?t:(o=t)?J(o,function(t){return M.isArrayLike(t)?K(t):function(t){if(!M.isPrototype(t))return G(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(o)):[],n=n&&!r?E.toInteger(n):0;var i=t.length;return n<0&&(n=Y(i+n,0)),M.isString(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,H,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n)>-1}});class V{constructor(){this._map=new Map}clear(){return this._map.clear(),this}on(t,e){if(!e)return this;let n=this._map.get(t);return n||(n=new Set,this._map.set(t,n)),n.add(e),this}emit(t,...e){const n=this._map.get(t);if(!n)return this;return[...n].forEach((t=>t(...e))),this}off(t="",e){if(!t)return this._map.clear(),this;if(!e)return this._map.delete(t.toString()),this;const n=this._map.get(t);return n?(n.delete(e),this):this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}has(t){return this._map.has(t)}}var X={groupBy:(t,e)=>t.reduce(((t,n)=>((t[n[e]]=t[n[e]]||[]).push(n),t)),{}),stepAction:function(t,e,n=100){if(!M.isFunction(e))return;if(!M.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let o=n+r,i=t.slice(r,o);e&&e(i),r=o}},skip:(t,e)=>{if(!M.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!M.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const o=e+r;return t.slice(r,t.length<o?t.length:o)||[]},distinct:t=>!M.isArray(t)||t.length<=0?[]:[...new Set(t)]};const tt="[object Object]",et="[object Array]",nt=t=>Object.prototype.toString.call(t),rt=(t,e,n=!1)=>{if(t===e)return;const r=nt(t);if(r===nt(e))if(r===et&&t.length>=e.length)for(let n=0;n<e.length;n++)rt(t[n],e[n]);else if(r===tt&&Object.keys(t).length>=Object.keys(e).length)for(let r in e)n||void 0!==t[r]?rt(t[r],e[r]):t[r]=null},ot=(t,e,n,r="",o=!1)=>{if(t===e)return;const i=nt(t),s=nt(e);if(i===et&&s===i&&t.length>=e.length)for(let o=0;o<t.length;o++)ot(t[o],e[o],n,`${r}[${o}]`);else if(i===tt&&s===i&&(o||Object.keys(t).length>=Object.keys(e).length)){const o=Object.keys(t);for(let i of o){const o=t[i],s=e[i],u=nt(o),c=nt(s);if(o!==s)if(u===et&&c===u&&o.length>=s.length)for(let t=0;t<o.length;t++)ot(o[t],s[t],n,`${r?r+".":""}${i}[${t}]`);else if(u===tt&&c===u&&Object.keys(o).length>=Object.keys(s).length)for(let t in o)ot(o[t],s[t],n,`${r?r+".":""}${i}.${t}`);else n[`${r?r+".":""}${i}`]=o}}else n[r]=t};const it=t=>"function"!=typeof t?t:(e={})=>new Promise(((n,r)=>{t(Object.assign(e,{success:n,fail:r}))}));var st={diff:function(t,e){const n={};return(t=>{if(nt(t)===tt)for(let e in t)if(/\w+\.\w+/g.test(e)&&-1===e.indexOf("[")){const n=e.split(".");let r=t,o=n.length;for(let t=0;t<o-1;t++){const e=n[t];nt(r[e])!==tt&&(r[e]={}),r=r[e]}r[n[o-1]]=t[e],delete t[e]}})(t),rt(t,e,!0),ot(t,e,n,"",!0),n},promixify:it,run:(t,e={})=>{if(t)return W.run(it(t)(e))},formatList:function(t,e,n){return(t||[]).reduce(((t,r,o)=>Object.assign(Object.assign({},t),{[`${n}[${e+o}]`]:r})),{})}};function ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const ct=function(t,{sep:e="&",eq:n="=",max:r=1e3,multiple:o=!1}={}){e=e||"&",n=n||"=";const i={};if("string"!=typeof t||0===t.length)return i;const s=/\+/g,u=r||1e3;let c=(t=t.split(e)).length;u>0&&c>u&&(c=u);for(let e=0;e<c;++e){let r,u,c,a,f=t[e].replace(s,"%20"),l=f.indexOf(n);l>=0?(r=f.substr(0,l),u=f.substr(l+1)):(r=f,u=""),c=decodeURIComponent(r),a=decodeURIComponent(u),ut(i,c)&&o?Array.isArray(i[c])?i[c].push(a):i[c]=[i[c],a]:i[c]=a}return i},at=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},ft=function(t,{sep:e="&",eq:n="=",name:r=null,multiple:o=!1}={}){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){const i=encodeURIComponent(at(r))+n;return o&&Array.isArray(t[r])?t[r].map((function(t){return i+encodeURIComponent(at(t))})).join(e):i+encodeURIComponent(at(t[r]))})).filter(Boolean).join(e):r?encodeURIComponent(at(r))+n+encodeURIComponent(at(t)):""};var lt={parse:ct,decode:ct,stringify:ft,encode:ft};var ht={validateId:function(t){return!!t&&(!(t.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(t))},validatePhone:function(t){return!!t&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(t)}};function gt(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))}class yt extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return gt(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!M.isFunction(n))return;const[,r]=yield W.run(n(this,e));return r}))}getByOnce(t){return gt(this,void 0,void 0,(function*(){const e=Reflect.get(this,t);let n;return n=null!=e&&""!==e?JSON.parse(JSON.stringify(e)):yield this.dispatch(t),n}))}}return{gbk:t,time:s,hook:W,math:q,util:Q,list:X,mini:st,url:lt,rule:ht,DEvent:V,store:yt,storeRef:t=>{const e=Object.assign(new yt,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return M.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const o=Reflect.get(t.setters,e);if(M.isFunction(o)&&!o(n))return!0;const i=Reflect.set(t,e,n,r);return i&&t.emit(e.toString(),n),i},has:(t,e)=>Reflect.has(t,e)})}}}));
|
package/bin/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const event_1 = require("./class/event");
|
|
|
9
9
|
const list_1 = require("./modules/list");
|
|
10
10
|
const mini_1 = require("./modules/mini");
|
|
11
11
|
const url_1 = require("./modules/url");
|
|
12
|
+
const rule_1 = require("./modules/rule");
|
|
12
13
|
const store_1 = require("./class/store");
|
|
13
14
|
// export { gbk, time, hook, math, util, list, DEvent, store, storeRef };
|
|
14
|
-
exports.default = { gbk: gbk_1.default, time: time_1.default, hook: hook_1.default, math: math_1.default, util: util_1.default, list: list_1.default, mini: mini_1.default, url: url_1.default, DEvent: event_1.default, store: store_1.default, storeRef: store_1.storeRef };
|
|
15
|
+
exports.default = { gbk: gbk_1.default, time: time_1.default, hook: hook_1.default, math: math_1.default, util: util_1.default, list: list_1.default, mini: mini_1.default, url: url_1.default, rule: rule_1.default, DEvent: event_1.default, store: store_1.default, storeRef: store_1.storeRef };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const time_1 = require("../time");
|
|
3
4
|
/**
|
|
4
5
|
* 随机取值[0, max)
|
|
5
6
|
* @param max 最大值
|
|
@@ -24,4 +25,16 @@ function randomRange(min, max) {
|
|
|
24
25
|
function lerp(start, end, t) {
|
|
25
26
|
return start * (1 - t) + end * t;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
function randomString(len, prefix = false) {
|
|
29
|
+
len = len || 32;
|
|
30
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
31
|
+
const maxPos = chars.length;
|
|
32
|
+
let pwd = "";
|
|
33
|
+
for (let i = 0; i < len; i++) {
|
|
34
|
+
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
|
|
35
|
+
}
|
|
36
|
+
if (!prefix)
|
|
37
|
+
return pwd;
|
|
38
|
+
return time_1.default.format(new Date, "yyyyMMddhhmmss") + pwd;
|
|
39
|
+
}
|
|
40
|
+
exports.default = { random, randomRange, lerp, randomString };
|
|
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const diff_1 = require("./diff");
|
|
4
4
|
const hook_1 = require("../hook");
|
|
5
5
|
const promixify = (miniapi) => {
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
6
|
+
if (typeof miniapi !== "function")
|
|
7
|
+
return miniapi;
|
|
8
|
+
return (args = {}) => new Promise((resolve, reject) => {
|
|
9
|
+
miniapi(Object.assign(args, { success: resolve, fail: reject }));
|
|
10
|
+
});
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// }
|
|
17
|
-
const api = (miniapi, options = null, ...params) => {
|
|
18
|
-
return hook_1.default.run(promixify(miniapi)(options, ...params));
|
|
12
|
+
const run = (func, args = {}) => {
|
|
13
|
+
if (!func)
|
|
14
|
+
return;
|
|
15
|
+
return hook_1.default.run(promixify(func)(args));
|
|
19
16
|
};
|
|
20
|
-
|
|
17
|
+
function formatList(lists, start, name) {
|
|
18
|
+
return (lists || []).reduce((res, val, index) => (Object.assign(Object.assign({}, res), { [`${name}[${start + index}]`]: val })), {});
|
|
19
|
+
}
|
|
20
|
+
exports.default = { diff: diff_1.default, promixify, run, formatList };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function validateId(content) {
|
|
4
|
+
if (!content)
|
|
5
|
+
return false;
|
|
6
|
+
if (content.length < 6)
|
|
7
|
+
return false;
|
|
8
|
+
const reg = /^[A-Za-z0-9_-]+$/;
|
|
9
|
+
if (!reg.test(content)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
function validatePhone(content) {
|
|
15
|
+
if (!content)
|
|
16
|
+
return false;
|
|
17
|
+
const reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
|
18
|
+
if (!reg.test(content)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// function validate(ob, rules, cb = (valid, rule) => {}) {
|
|
24
|
+
// if (!ob) return false;
|
|
25
|
+
// for (const rule of rules) {
|
|
26
|
+
// if (!rule || !rule.name || !rule.rules) continue;
|
|
27
|
+
// const val = ob[rule.name];
|
|
28
|
+
// let invalid = !val;
|
|
29
|
+
// if (!invalid && Array.isArray(val)) {
|
|
30
|
+
// invalid = val.length <= 0 || !val.every((e) => !!e);
|
|
31
|
+
// }
|
|
32
|
+
// if (Array.isArray(rule.rules)) {
|
|
33
|
+
// for (const item of rule.rules) {
|
|
34
|
+
// if (invalid && item.required) {
|
|
35
|
+
// cb && cb(rule, item);
|
|
36
|
+
// return false;
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
// } else {
|
|
40
|
+
// if (invalid && rule.rules.required) {
|
|
41
|
+
// cb && cb(rule, rule.rules);
|
|
42
|
+
// return false;
|
|
43
|
+
// } else if (rule.rules.validator) {
|
|
44
|
+
// if (!rule.rules.validator(rule, val)) {
|
|
45
|
+
// cb && cb(rule, rule.rules);
|
|
46
|
+
// return false;
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// return true;
|
|
52
|
+
// }
|
|
53
|
+
exports.default = { validateId, validatePhone };
|
package/bin/types/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ declare const _default: {
|
|
|
33
33
|
random: (max: number) => number;
|
|
34
34
|
randomRange: (min: number, max: number) => number;
|
|
35
35
|
lerp: (start: number, end: number, t: number) => number;
|
|
36
|
+
randomString: (len: any, prefix?: boolean) => string;
|
|
36
37
|
};
|
|
37
38
|
util: {
|
|
38
39
|
includes: typeof import("./util/includes").default;
|
|
@@ -66,14 +67,39 @@ declare const _default: {
|
|
|
66
67
|
};
|
|
67
68
|
mini: {
|
|
68
69
|
diff: typeof import("./modules/mini/diff").default;
|
|
69
|
-
promixify: (
|
|
70
|
-
|
|
70
|
+
promixify: (miniapi: any) => any;
|
|
71
|
+
run: (func: any, args?: {}) => Promise<any[]> | undefined;
|
|
72
|
+
formatList: (lists: any[], start: any, name: any) => any;
|
|
71
73
|
};
|
|
72
74
|
url: {
|
|
73
|
-
parse: (qs: any, sep
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
parse: (qs: any, { sep, eq, max, multiple }?: {
|
|
76
|
+
sep?: string | undefined;
|
|
77
|
+
eq?: string | undefined;
|
|
78
|
+
max?: number | undefined;
|
|
79
|
+
multiple?: boolean | undefined;
|
|
80
|
+
}) => {};
|
|
81
|
+
decode: (qs: any, { sep, eq, max, multiple }?: {
|
|
82
|
+
sep?: string | undefined;
|
|
83
|
+
eq?: string | undefined;
|
|
84
|
+
max?: number | undefined;
|
|
85
|
+
multiple?: boolean | undefined;
|
|
86
|
+
}) => {};
|
|
87
|
+
stringify: (obj: any, { sep, eq, name, multiple }?: {
|
|
88
|
+
sep?: string | undefined;
|
|
89
|
+
eq?: string | undefined;
|
|
90
|
+
name?: null | undefined;
|
|
91
|
+
multiple?: boolean | undefined;
|
|
92
|
+
}) => string;
|
|
93
|
+
encode: (obj: any, { sep, eq, name, multiple }?: {
|
|
94
|
+
sep?: string | undefined;
|
|
95
|
+
eq?: string | undefined;
|
|
96
|
+
name?: null | undefined;
|
|
97
|
+
multiple?: boolean | undefined;
|
|
98
|
+
}) => string;
|
|
99
|
+
};
|
|
100
|
+
rule: {
|
|
101
|
+
validateId: (content: any) => boolean;
|
|
102
|
+
validatePhone: (content: any) => boolean;
|
|
77
103
|
};
|
|
78
104
|
DEvent: typeof DEvent;
|
|
79
105
|
store: typeof store;
|
|
@@ -16,9 +16,11 @@ declare function randomRange(min: number, max: number): number;
|
|
|
16
16
|
* @param t
|
|
17
17
|
*/
|
|
18
18
|
declare function lerp(start: number, end: number, t: number): number;
|
|
19
|
+
declare function randomString(len: any, prefix?: boolean): string;
|
|
19
20
|
declare const _default: {
|
|
20
21
|
random: typeof random;
|
|
21
22
|
randomRange: typeof randomRange;
|
|
22
23
|
lerp: typeof lerp;
|
|
24
|
+
randomString: typeof randomString;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import diff from "./diff";
|
|
2
|
+
declare function formatList(lists: any[], start: any, name: any): any;
|
|
2
3
|
declare const _default: {
|
|
3
4
|
diff: typeof diff;
|
|
4
|
-
promixify: (miniapi: any) =>
|
|
5
|
-
|
|
5
|
+
promixify: (miniapi: any) => any;
|
|
6
|
+
run: (func: any, args?: {}) => Promise<any[]> | undefined;
|
|
7
|
+
formatList: typeof formatList;
|
|
6
8
|
};
|
|
7
9
|
export default _default;
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
parse: (qs: any, sep
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
parse: (qs: any, { sep, eq, max, multiple }?: {
|
|
3
|
+
sep?: string | undefined;
|
|
4
|
+
eq?: string | undefined;
|
|
5
|
+
max?: number | undefined;
|
|
6
|
+
multiple?: boolean | undefined;
|
|
7
|
+
}) => {};
|
|
8
|
+
decode: (qs: any, { sep, eq, max, multiple }?: {
|
|
9
|
+
sep?: string | undefined;
|
|
10
|
+
eq?: string | undefined;
|
|
11
|
+
max?: number | undefined;
|
|
12
|
+
multiple?: boolean | undefined;
|
|
13
|
+
}) => {};
|
|
14
|
+
stringify: (obj: any, { sep, eq, name, multiple }?: {
|
|
15
|
+
sep?: string | undefined;
|
|
16
|
+
eq?: string | undefined;
|
|
17
|
+
name?: null | undefined;
|
|
18
|
+
multiple?: boolean | undefined;
|
|
19
|
+
}) => string;
|
|
20
|
+
encode: (obj: any, { sep, eq, name, multiple }?: {
|
|
21
|
+
sep?: string | undefined;
|
|
22
|
+
eq?: string | undefined;
|
|
23
|
+
name?: null | undefined;
|
|
24
|
+
multiple?: boolean | undefined;
|
|
25
|
+
}) => string;
|
|
6
26
|
};
|
|
7
27
|
export default _default;
|