ddan-js 1.2.0 → 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.
@@ -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 i=0;i<t.length&&(t.charCodeAt(i)>127||94===t.charCodeAt(i)?n+=2:n++,!(n>e));i++)r=i;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 i=(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 o(){return r.Date.now()}var u={now:o,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:i,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:o=0,second:u=0}){const s=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${o}:${u}`;return new Date(i(Date.now(),s)).getTime()},todayZero:()=>new Date(i(o(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const s=r.Symbol,{toString:c,hasOwnProperty:a,propertyIsEnumerable:f}=Object.prototype,l=s?s.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 i=c.call(t);return r&&(e?t[l]=n:delete t[l]),i}(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]",m="[object AsyncFunction]",p=9007199254740991;const b=/^(?:0|[1-9]\d*)$/;function v(t){const e=typeof t;return null!=t&&("object"==e||"function"==e)}function S(t){return null!=t&&"object"==typeof t}const j=Array.isArray;function O(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=p}(t.length)&&!M(t)}function w(t){return S(t)&&O(t)}function M(t){var e=v(t)?g.getTag(t):"";return e===y||e===d||e===m}var A={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||!j(t)&&S(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:S,isSymbol:function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"===g.getTag(t)},isFunction:M,isArray:j,isArrayLikeObject:w,isIndex:function(t,e){return!!(e=null==e?p:e)&&("number"==typeof t||b.test(t))&&t>-1&&t%1==0&&t<e},isArrayLike:O,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 T=NaN,x=/^\s+|\s+$/g,D=/^[-+]0x[0-9a-f]+$/i,P=/^0b[01]+$/i,$=/^0o[0-7]+$/i,F=parseInt,k=1/0,E=17976931348623157e292;function N(t){if("number"==typeof t)return t;if(A.isSymbol(t))return T;if(A.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=A.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(x,"");const e=P.test(t);return e||$.test(t)?F(t.slice(2),e?2:8):D.test(t)?T:+t}function R(t){return t?(t=N(t))===k||t===-k?(t<0?-1:1)*E:t==t?t:0:0===t?t:0}var _={toNumber:N,toFinite:R,toInteger:function(t){var e=R(t),n=e%1;return e==e?n?e-n:e:0}};const I="Expected a function",C=Math.max,L=Math.min;function W(t,e=0,n={}){var r,i,o,u,s,c,a=0,f=!1,l=!1,h=!0;if("function"!=typeof t)throw new TypeError(I);function g(e){var n=r,o=i;return r=i=void 0,a=e,u=t.apply(o,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||l&&t-a>=o}function d(){var t=Date.now();if(y(t))return m(t);s=setTimeout(d,function(t){var n=e-(t-c);return l?L(n,o-(t-a)):n}(t))}function m(t){return s=void 0,h&&r?g(t):(r=i=void 0,u)}function p(...t){var n=Date.now(),o=y(n);if(r=arguments,i=this,c=n,o){if(void 0===s)return function(t){return a=t,s=setTimeout(d,e),f?g(t):u}(c);if(l)return s=setTimeout(d,e),g(c)}return void 0===s&&(s=setTimeout(d,e)),u}return e=_.toNumber(e)||0,A.isObject(n)&&(f=!!n.leading,o=(l="maxWait"in n)?C(_.toNumber(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h),p.cancel=function(){void 0!==s&&clearTimeout(s),a=0,r=c=i=s=void 0},p.flush=function(){return void 0===s?u:m(Date.now())},p}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=A.isFunction(this.source)?this.source():this.source,t=A.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 H={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:W,throttle:function(t,e=0,n={}){var r=!1,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return A.isObject(n)&&(r=n.leading?!!n.leading:r,i=n.trailing?!!n.trailing:i),W(t,e,{leading:r,maxWait:e,trailing:i})}};var J={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 U(t){return t!=t}function G(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}(e,(function(e){return t[e]}))}var Y,Z,q=(Y=Object.keys,Z=Object,function(t){return Y(Z(t))}),z=Math.max;function K(t,e){var n=A.isArray(t)||A.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,i=!!r;for(var o in t)!e&&!g.hasOwnProperty.call(t,o)||i&&("length"==o||A.isIndex(o,r))||n.push(o);return n}var Q=Object.assign(Object.assign(Object.assign({},A),g),{includes:function(t,e,n,r){var i;t=A.isArrayLike(t)?t:(i=t)?G(i,function(t){return A.isArrayLike(t)?K(t):function(t){if(!A.isPrototype(t))return q(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(i)):[],n=n&&!r?_.toInteger(n):0;var o=t.length;return n<0&&(n=z(o+n,0)),A.isString(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,U,n);for(var r=n-1,i=t.length;++r<i;)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(!A.isFunction(e))return;if(!A.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let i=n+r,o=t.slice(r,i);e&&e(o),r=i}},skip:(t,e)=>{if(!A.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!A.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const i=e+r;return t.slice(r,t.length<i?t.length:i)||[]},distinct:t=>!A.isArray(t)||t.length<=0?[]:[...new Set(t)]};function tt(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,s)}c((r=r.apply(t,e||[])).next())}))}class et extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return tt(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!A.isFunction(n))return;const[,r]=yield H.run(n(this,e));return r}))}getByOnce(t){return tt(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 nt={gbk:t,time:u,hook:H,math:J,util:Q,list:X,DEvent:V,store:et,storeRef:t=>{const e=Object.assign(new et,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return A.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const i=Reflect.get(t.setters,e);if(A.isFunction(i)&&!i(n))return!0;const o=Reflect.set(t,e,n,r);return o&&t.emit(e.toString(),n),o},has:(t,e)=>Reflect.has(t,e)})}};export{nt 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 i=0;i<t.length&&(t.charCodeAt(i)>127||94===t.charCodeAt(i)?n+=2:n++,!(n>e));i++)r=i;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 i=(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 o(){return r.Date.now()}var u={now:o,isToday:t=>(new Date).toDateString()===new Date(t).toDateString(),format:i,parseTime:function({year:t=0,month:e=0,date:n=0,hour:r=0,minute:o=0,second:u=0}){const s=`${t||"yyyy"}/${e||"MM"}/${n||"dd"} ${r}:${o}:${u}`;return new Date(i(Date.now(),s)).getTime()},todayZero:()=>new Date(i(o(),"yyyy/MM/dd 00:00:00")).getTime(),oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};const s=r.Symbol,{toString:c,hasOwnProperty:a,propertyIsEnumerable:f}=Object.prototype,l=s?s.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 i=c.call(t);return r&&(e?t[l]=n:delete t[l]),i}(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 S(t){return null!=t&&"object"==typeof t}const j=Array.isArray;function O(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=m}(t.length)&&!M(t)}function w(t){return S(t)&&O(t)}function M(t){var e=v(t)?g.getTag(t):"";return e===y||e===d||e===p}var A={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||!j(t)&&S(t)&&"[object String]"==g.getTag(t)},isChinese:function(t){return!!t&&!!/^[\u4E00-\u9FA5]+$/.test(t)},isObject:v,isObjectLike:S,isSymbol:function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"===g.getTag(t)},isFunction:M,isArray:j,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:O,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 T=NaN,x=/^\s+|\s+$/g,D=/^[-+]0x[0-9a-f]+$/i,P=/^0b[01]+$/i,$=/^0o[0-7]+$/i,F=parseInt,k=1/0,E=17976931348623157e292;function N(t){if("number"==typeof t)return t;if(A.isSymbol(t))return T;if(A.isObject(t)){const e="function"==typeof t.valueOf?t.valueOf():t;t=A.isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(x,"");const e=P.test(t);return e||$.test(t)?F(t.slice(2),e?2:8):D.test(t)?T:+t}function R(t){return t?(t=N(t))===k||t===-k?(t<0?-1:1)*E:t==t?t:0:0===t?t:0}var _={toNumber:N,toFinite:R,toInteger:function(t){var e=R(t),n=e%1;return e==e?n?e-n:e:0}};const I="Expected a function",C=Math.max,L=Math.min;function W(t,e=0,n={}){var r,i,o,u,s,c,a=0,f=!1,l=!1,h=!0;if("function"!=typeof t)throw new TypeError(I);function g(e){var n=r,o=i;return r=i=void 0,a=e,u=t.apply(o,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||l&&t-a>=o}function d(){var t=Date.now();if(y(t))return p(t);s=setTimeout(d,function(t){var n=e-(t-c);return l?L(n,o-(t-a)):n}(t))}function p(t){return s=void 0,h&&r?g(t):(r=i=void 0,u)}function m(...t){var n=Date.now(),o=y(n);if(r=arguments,i=this,c=n,o){if(void 0===s)return function(t){return a=t,s=setTimeout(d,e),f?g(t):u}(c);if(l)return s=setTimeout(d,e),g(c)}return void 0===s&&(s=setTimeout(d,e)),u}return e=_.toNumber(e)||0,A.isObject(n)&&(f=!!n.leading,o=(l="maxWait"in n)?C(_.toNumber(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),a=0,r=c=i=s=void 0},m.flush=function(){return void 0===s?u:p(Date.now())},m}class B{constructor(t){this.source=t}run(){let t;try{let e;return e=A.isFunction(this.source)?this.source():this.source,t=A.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 H={sleep:(t=1e3)=>new Promise((e=>{setTimeout(e,t)})),run:t=>new B(t).run(),debounce:W,throttle:function(t,e=0,n={}){var r=!1,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return A.isObject(n)&&(r=n.leading?!!n.leading:r,i=n.trailing?!!n.trailing:i),W(t,e,{leading:r,maxWait:e,trailing:i})}};var J={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 U(t){return t!=t}function G(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}(e,(function(e){return t[e]}))}var Y,Z,q=(Y=Object.keys,Z=Object,function(t){return Y(Z(t))}),z=Math.max;function K(t,e){var n=A.isArray(t)||A.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,i=!!r;for(var o in t)!e&&!g.hasOwnProperty.call(t,o)||i&&("length"==o||A.isIndex(o,r))||n.push(o);return n}var Q=Object.assign(Object.assign(Object.assign({},A),g),{includes:function(t,e,n,r){var i;t=A.isArrayLike(t)?t:(i=t)?G(i,function(t){return A.isArrayLike(t)?K(t):function(t){if(!A.isPrototype(t))return q(t);var e=[];for(var n in Object(t))g.hasOwnProperty.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}(i)):[],n=n&&!r?_.toInteger(n):0;var o=t.length;return n<0&&(n=z(o+n,0)),A.isString(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,U,n);for(var r=n-1,i=t.length;++r<i;)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(!A.isFunction(e))return;if(!A.isArray(t)||t.length<=0)return;let r=0;for(;t.length>r;){let i=n+r,o=t.slice(r,i);e&&e(o),r=i}},skip:(t,e)=>{if(!A.isArray(t)||t.length<=0)return[];const n=e;return t.slice(n)},take:(t,e,n=0)=>{if(!A.isArray(t)||t.length<=0)return[];const r=n||0;if(r>=t.length)return[];const i=e+r;return t.slice(r,t.length<i?t.length:i)||[]},distinct:t=>!A.isArray(t)||t.length<=0?[]:[...new Set(t)]};function tt(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,s)}c((r=r.apply(t,e||[])).next())}))}class et extends V{constructor(){super(),this.getters={},this.setters={},this.actions={}}dispatch(t,e=void 0){return tt(this,void 0,void 0,(function*(){const n=Reflect.get(this.actions,t);if(!A.isFunction(n))return;const[,r]=yield H.run(n(this,e));return r}))}getByOnce(t){return tt(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:u,hook:H,math:J,util:Q,list:X,DEvent:V,store:et,storeRef:t=>{const e=Object.assign(new et,t||{});return new Proxy(e,{get:(t,e,n)=>{const r=Reflect.get(t.getters,e);return A.isFunction(r)?r():Reflect.get(t,e,n)},set:(t,e,n,r)=>{const i=Reflect.get(t.setters,e);if(A.isFunction(i)&&!i(n))return!0;const o=Reflect.set(t,e,n,r);return o&&t.emit(e.toString(),n),o},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
@@ -7,6 +7,9 @@ const math_1 = require("./modules/math");
7
7
  const util_1 = require("./util");
8
8
  const event_1 = require("./class/event");
9
9
  const list_1 = require("./modules/list");
10
+ const mini_1 = require("./modules/mini");
11
+ const url_1 = require("./modules/url");
12
+ const rule_1 = require("./modules/rule");
10
13
  const store_1 = require("./class/store");
11
14
  // export { gbk, time, hook, math, util, list, DEvent, store, storeRef };
12
- 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, 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
- exports.default = { random, randomRange, lerp };
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 };
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const OBJECT_TYPE = "[object Object]";
4
+ const ARRAY_TYPE = "[object Array]";
5
+ const getType = (obj) => Object.prototype.toString.call(obj);
6
+ const initPath = (data) => {
7
+ if (getType(data) !== OBJECT_TYPE)
8
+ return;
9
+ for (let item in data) {
10
+ if (/\w+\.\w+/g.test(item) && item.indexOf("[") === -1) {
11
+ const arr = item.split(".");
12
+ let result = data, len = arr.length;
13
+ for (let i = 0; i < len - 1; i++) {
14
+ const arrItem = arr[i];
15
+ if (getType(result[arrItem]) !== OBJECT_TYPE) {
16
+ result[arrItem] = {};
17
+ }
18
+ result = result[arrItem];
19
+ }
20
+ result[arr[len - 1]] = data[item];
21
+ delete data[item];
22
+ }
23
+ }
24
+ };
25
+ const initData = (cur, pre, root = false) => {
26
+ if (cur === pre)
27
+ return;
28
+ const curType = getType(cur), preType = getType(pre);
29
+ if (curType !== preType)
30
+ return;
31
+ if (curType === ARRAY_TYPE && cur.length >= pre.length) {
32
+ for (let i = 0; i < pre.length; i++) {
33
+ initData(cur[i], pre[i]);
34
+ }
35
+ }
36
+ else if (curType === OBJECT_TYPE && Object.keys(cur).length >= Object.keys(pre).length) {
37
+ for (let key in pre) {
38
+ if (!root && cur[key] === undefined) {
39
+ cur[key] = null;
40
+ }
41
+ else {
42
+ initData(cur[key], pre[key]);
43
+ }
44
+ }
45
+ }
46
+ };
47
+ const doDiff = (cur, pre, target, path = "", root = false) => {
48
+ if (cur === pre)
49
+ return;
50
+ const curRootType = getType(cur), preRootType = getType(pre);
51
+ if (curRootType === ARRAY_TYPE && preRootType === curRootType && cur.length >= pre.length) {
52
+ for (let i = 0; i < cur.length; i++) {
53
+ doDiff(cur[i], pre[i], target, `${path}[${i}]`);
54
+ }
55
+ return;
56
+ }
57
+ if (curRootType === OBJECT_TYPE &&
58
+ preRootType === curRootType &&
59
+ (root || Object.keys(cur).length >= Object.keys(pre).length)) {
60
+ const keys = Object.keys(cur);
61
+ for (let key of keys) {
62
+ const curVal = cur[key], preVal = pre[key];
63
+ const curType = getType(curVal), preType = getType(preVal);
64
+ if (curVal === preVal)
65
+ continue;
66
+ if (curType === ARRAY_TYPE && preType === curType && curVal.length >= preVal.length) {
67
+ for (let i = 0; i < curVal.length; i++) {
68
+ doDiff(curVal[i], preVal[i], target, `${path ? path + "." : ""}${key}[${i}]`);
69
+ }
70
+ continue;
71
+ }
72
+ if (curType === OBJECT_TYPE && preType === curType && Object.keys(curVal).length >= Object.keys(preVal).length) {
73
+ for (let sKey in curVal) {
74
+ doDiff(curVal[sKey], preVal[sKey], target, `${path ? path + "." : ""}${key}.${sKey}`);
75
+ }
76
+ continue;
77
+ }
78
+ target[`${path ? path + "." : ""}${key}`] = curVal;
79
+ }
80
+ return;
81
+ }
82
+ target[path] = cur;
83
+ };
84
+ function diff(data, prevData) {
85
+ const target = {};
86
+ initPath(data);
87
+ initData(data, prevData, true);
88
+ doDiff(data, prevData, target, "", true);
89
+ return target;
90
+ }
91
+ exports.default = diff;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const diff_1 = require("./diff");
4
+ const hook_1 = require("../hook");
5
+ const promixify = (miniapi) => {
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
+ };
12
+ const run = (func, args = {}) => {
13
+ if (!func)
14
+ return;
15
+ return hook_1.default.run(promixify(func)(args));
16
+ };
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 };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function hasOwnProperty(obj, prop) {
4
+ return Object.prototype.hasOwnProperty.call(obj, prop);
5
+ }
6
+ const decode = function (qs, { sep = "&", eq = "=", max = 1000, multiple = false } = {}) {
7
+ sep = sep || '&';
8
+ eq = eq || '=';
9
+ const obj = {};
10
+ if (typeof qs !== 'string' || qs.length === 0) {
11
+ return obj;
12
+ }
13
+ const regexp = /\+/g;
14
+ qs = qs.split(sep);
15
+ const maxKeys = max || 1000;
16
+ let len = qs.length;
17
+ // maxKeys <= 0 means that we should not limit keys count
18
+ if (maxKeys > 0 && len > maxKeys) {
19
+ len = maxKeys;
20
+ }
21
+ for (let i = 0; i < len; ++i) {
22
+ let x = qs[i].replace(regexp, '%20'), idx = x.indexOf(eq), kstr, vstr, k, v;
23
+ if (idx >= 0) {
24
+ kstr = x.substr(0, idx);
25
+ vstr = x.substr(idx + 1);
26
+ }
27
+ else {
28
+ kstr = x;
29
+ vstr = '';
30
+ }
31
+ k = decodeURIComponent(kstr);
32
+ v = decodeURIComponent(vstr);
33
+ if (!hasOwnProperty(obj, k) || !multiple) {
34
+ obj[k] = v;
35
+ }
36
+ else if (Array.isArray(obj[k])) {
37
+ obj[k].push(v);
38
+ }
39
+ else {
40
+ obj[k] = [obj[k], v];
41
+ }
42
+ }
43
+ return obj;
44
+ };
45
+ exports.default = decode;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stringifyPrimitive = function (v) {
4
+ switch (typeof v) {
5
+ case 'string':
6
+ return v;
7
+ case 'boolean':
8
+ return v ? 'true' : 'false';
9
+ case 'number':
10
+ return isFinite(v) ? v : '';
11
+ default:
12
+ return '';
13
+ }
14
+ };
15
+ const encode = function (obj, { sep = "&", eq = "=", name = null, multiple = false } = {}) {
16
+ sep = sep || '&';
17
+ eq = eq || '=';
18
+ if (obj === null) {
19
+ obj = undefined;
20
+ }
21
+ if (typeof obj === 'object') {
22
+ return Object.keys(obj).map(function (k) {
23
+ const ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
24
+ if (multiple && Array.isArray(obj[k])) {
25
+ return obj[k].map(function (v) {
26
+ return ks + encodeURIComponent(stringifyPrimitive(v));
27
+ }).join(sep);
28
+ }
29
+ else {
30
+ return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
31
+ }
32
+ }).filter(Boolean).join(sep);
33
+ }
34
+ if (!name)
35
+ return '';
36
+ return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
37
+ };
38
+ exports.default = encode;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const decode_1 = require("./decode");
4
+ const encode_1 = require("./encode");
5
+ exports.default = { parse: decode_1.default, decode: decode_1.default, stringify: encode_1.default, encode: encode_1.default };
@@ -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;
@@ -64,6 +65,42 @@ declare const _default: {
64
65
  take: (list: any[], count: number, skip?: number) => any[];
65
66
  distinct: (list: any[]) => any[];
66
67
  };
68
+ mini: {
69
+ diff: typeof import("./modules/mini/diff").default;
70
+ promixify: (miniapi: any) => any;
71
+ run: (func: any, args?: {}) => Promise<any[]> | undefined;
72
+ formatList: (lists: any[], start: any, name: any) => any;
73
+ };
74
+ url: {
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;
103
+ };
67
104
  DEvent: typeof DEvent;
68
105
  store: typeof store;
69
106
  storeRef: (source: import("./typings").IDStore) => store & import("./typings").IDStore;
@@ -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;
@@ -0,0 +1 @@
1
+ export default function diff(data: any, prevData: any): {};
@@ -0,0 +1,9 @@
1
+ import diff from "./diff";
2
+ declare function formatList(lists: any[], start: any, name: any): any;
3
+ declare const _default: {
4
+ diff: typeof diff;
5
+ promixify: (miniapi: any) => any;
6
+ run: (func: any, args?: {}) => Promise<any[]> | undefined;
7
+ formatList: typeof formatList;
8
+ };
9
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare function validateId(content: any): boolean;
2
+ declare function validatePhone(content: any): boolean;
3
+ declare const _default: {
4
+ validateId: typeof validateId;
5
+ validatePhone: typeof validatePhone;
6
+ };
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const decode: (qs: any, { sep, eq, max, multiple }?: {
2
+ sep?: string | undefined;
3
+ eq?: string | undefined;
4
+ max?: number | undefined;
5
+ multiple?: boolean | undefined;
6
+ }) => {};
7
+ export default decode;
@@ -0,0 +1,7 @@
1
+ declare const encode: (obj: any, { sep, eq, name, multiple }?: {
2
+ sep?: string | undefined;
3
+ eq?: string | undefined;
4
+ name?: null | undefined;
5
+ multiple?: boolean | undefined;
6
+ }) => string;
7
+ export default encode;
@@ -0,0 +1,27 @@
1
+ declare const _default: {
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;
26
+ };
27
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "bin/ddan-js.js",