@lntvow/utils 1.8.9 → 1.8.10
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/dist/index.cjs +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function S(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function p(n){return n>10?p(10)+p(n-10):Math.random().toString(36).padEnd(12,"0").slice(2,n+2)}const l=Object.prototype.toString,f=n=>l.call(n),w=(...n)=>console.log(`%c ${n[0]} `,"padding: 2px 1px; border-radius: 3px 3px 3px 3px; color: #fff; background: #000; font-weight: bold;",n.slice(1)),E=(...n)=>console.warn(...n),C=(...n)=>console.error(...n),A=n=>f(n)==="[object Map]",j=n=>f(n)==="[object Set]",g=n=>f(n)==="[object Date]",h=n=>f(n)==="[object RegExp]",a=n=>typeof n=="function",$=n=>typeof n=="string",M=n=>typeof n=="symbol",u=n=>n!==null&&typeof n=="object",U=n=>u(n)&&a(n.then)&&a(n.catch),c=n=>n==null,x=n=>n===void 0,b=n=>n===null;function N(n){return n!=null}function R(n){return typeof n=="boolean"}const d=Array.isArray,m=(n,e)=>Object.hasOwn(n,e),D=(n,e)=>n!==e;function O(n){const e=new WeakMap;function r(t){if(g(t))return new Date(t);if(h(t))return new RegExp(t);if(u(t)){if(e.has(t))return e.get(t);let o={};if(d(t)){o=[],e.set(t,o);for(let i=0;i<t.length;i++)o[i]=r(t[i]);return o}e.set(t,o);for(const i in t)m(t,i)&&(o[i]=r(t[i]));return o}else return t}return r(n)}function y(n,e,r){return d(n)?T(n,e,r):P(n,e,r)}function P(n,e,r){const t=s(e,r);return Object.keys(n).forEach(i=>{c(e[i])?t[i]=s(n[i],r):t[i]=u(n[i])&&u(e[i])?y(n[i],e[i],r):s(e[i],r)}),t}function T(n,e,r){if(d(e)){const t=s(e,r);return t.push(...s(n,r)),t}else return s(n,r)}function s(n,e){const{isDeepClone:r=!0}=e||{};return r?O(n):n}function F(n,e=1e3){let r=null;return function(...t){r&&clearTimeout(r),r=setTimeout(()=>{n.apply(this
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function S(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function p(n){return n>10?p(10)+p(n-10):Math.random().toString(36).padEnd(12,"0").slice(2,n+2)}const l=Object.prototype.toString,f=n=>l.call(n),w=(...n)=>console.log(`%c ${n[0]} `,"padding: 2px 1px; border-radius: 3px 3px 3px 3px; color: #fff; background: #000; font-weight: bold;",n.slice(1)),E=(...n)=>console.warn(...n),C=(...n)=>console.error(...n),A=n=>f(n)==="[object Map]",j=n=>f(n)==="[object Set]",g=n=>f(n)==="[object Date]",h=n=>f(n)==="[object RegExp]",a=n=>typeof n=="function",$=n=>typeof n=="string",M=n=>typeof n=="symbol",u=n=>n!==null&&typeof n=="object",U=n=>u(n)&&a(n.then)&&a(n.catch),c=n=>n==null,x=n=>n===void 0,b=n=>n===null;function N(n){return n!=null}function R(n){return typeof n=="boolean"}const d=Array.isArray,m=(n,e)=>Object.hasOwn(n,e),D=(n,e)=>n!==e;function O(n){const e=new WeakMap;function r(t){if(g(t))return new Date(t);if(h(t))return new RegExp(t);if(u(t)){if(e.has(t))return e.get(t);let o={};if(d(t)){o=[],e.set(t,o);for(let i=0;i<t.length;i++)o[i]=r(t[i]);return o}e.set(t,o);for(const i in t)m(t,i)&&(o[i]=r(t[i]));return o}else return t}return r(n)}function y(n,e,r){return d(n)?T(n,e,r):P(n,e,r)}function P(n,e,r){const t=s(e,r);return Object.keys(n).forEach(i=>{c(e[i])?t[i]=s(n[i],r):t[i]=u(n[i])&&u(e[i])?y(n[i],e[i],r):s(e[i],r)}),t}function T(n,e,r){if(d(e)){const t=s(e,r);return t.push(...s(n,r)),t}else return s(n,r)}function s(n,e){const{isDeepClone:r=!0}=e||{};return r?O(n):n}function F(n,e=1e3){let r=null;return function(...t){r&&clearTimeout(r),r=setTimeout(()=>{n.apply(this,t)},e)}}function L(n,e=1e3){let r=null;return function(...t){if(b(r))return r=Date.now(),n.apply(this,t);{const o=Date.now();if(o-r>=e)return r=o,n.apply(this,t)}}}function Z(...n){return n.reduce((e,r)=>function(...t){return r(e(...t))})}function z(...n){return n.reduce((e,r)=>function(...t){return e(r(...t))})}function _(n){return/^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[1589]))\d{8}$/.test(n)}function B(n){return/^([\w-])+@([\w-])+(.[\w-])+/.test(n)}function I(n){return/^[A-Z]+$/.test(n)}function K(n){return!c(n)&&/^[a-z]+$/.test(n)}function W(n){return/^\d+$/.test(n)}function q(n){return/^-?\d{1,3}\.\d{6}$/.test(n)}function G(n){return n===""}function H(n){return!c(n)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(n)}function J(n){return!c(n)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(n)}function Q(n){return!c(n)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(n)}function V(n){return/^[\dA-Z_]+$/.test(n)}function X(n){return/^[1-9]\d*$/.test(n)}function Y(n){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(n)}function k(n){return Array.isArray(n)?n:[n]}exports.castArray=k;exports.compose=Z;exports.composeRight=z;exports.debounce=F;exports.deepClone=O;exports.deepMerge=y;exports.error=C;exports.getRandomColor=S;exports.getRandomString=p;exports.hasChanged=D;exports.hasOwn=m;exports.isArray=d;exports.isBoolean=R;exports.isChineseOrEnglish=J;exports.isChineseOrEnglishOrNumber=H;exports.isDate=g;exports.isDef=N;exports.isEmail=B;exports.isEmptyString=G;exports.isFunction=a;exports.isLatitudeOrLongitude=q;exports.isLowerCase=K;exports.isMap=A;exports.isMobilePhone=_;exports.isNull=b;exports.isNumber=W;exports.isObject=u;exports.isPositiveFloat=Y;exports.isPositiveInt=X;exports.isPromise=U;exports.isRegExp=h;exports.isSet=j;exports.isString=$;exports.isSymbol=M;exports.isUndef=c;exports.isUndefined=x;exports.isUpperCase=I;exports.isUppercaseOrNumbersOrSpecial=Q;exports.isUppercaseOrNumbersOrUnderline=V;exports.log=w;exports.objectToString=l;exports.throttle=L;exports.toTypeString=f;exports.warn=E;
|
package/dist/index.mjs
CHANGED
|
@@ -66,7 +66,7 @@ function P(n, e = 1e3) {
|
|
|
66
66
|
let r = null;
|
|
67
67
|
return function(...t) {
|
|
68
68
|
r && clearTimeout(r), r = setTimeout(() => {
|
|
69
|
-
n.apply(this,
|
|
69
|
+
n.apply(this, t);
|
|
70
70
|
}, e);
|
|
71
71
|
};
|
|
72
72
|
}
|
|
@@ -74,11 +74,11 @@ function T(n, e = 1e3) {
|
|
|
74
74
|
let r = null;
|
|
75
75
|
return function(...t) {
|
|
76
76
|
if (b(r))
|
|
77
|
-
return r = Date.now(), n.apply(this,
|
|
77
|
+
return r = Date.now(), n.apply(this, t);
|
|
78
78
|
{
|
|
79
79
|
const i = Date.now();
|
|
80
80
|
if (i - r >= e)
|
|
81
|
-
return r = i, n.apply(this,
|
|
81
|
+
return r = i, n.apply(this, t);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
}
|