@lntvow/utils 2.0.9 → 2.0.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 +7 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function l(t){return t>10?l(10)+l(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const p=Object.prototype.toString,d=t=>p.call(t),S=(...t)=>console.log(`%c ${t[0]} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",t.slice(1).length>0?t.slice(1):""),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function l(t){return t>10?l(10)+l(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const p=Object.prototype.toString,d=t=>p.call(t),S=(...t)=>console.log(`%c ${t[0]} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",t.slice(1).length>0?t.slice(1):""),A=(...t)=>console.warn(...t),E=(...t)=>console.error(...t),C=t=>d(t)==="[object Map]",$=t=>d(t)==="[object Set]",g=t=>d(t)==="[object Date]",b=t=>d(t)==="[object RegExp]",f=t=>typeof t=="function",w=t=>typeof t=="number",j=t=>typeof t=="string",v=t=>typeof t=="symbol",a=t=>t!==null&&typeof t=="object",M=t=>a(t)&&f(t.then)&&f(t.catch),s=t=>t==null,N=t=>t===void 0,U=t=>t===null,P=t=>t!=null,R=t=>typeof t=="boolean",u=Array.isArray,h=(t,e)=>Object.hasOwn(t,e),D=(t,e)=>t!==e;function m(t){const e=new WeakMap;function r(n){if(g(n))return new Date(n);if(b(n))return new RegExp(n);if(a(n)){if(e.has(n))return e.get(n);let i={};if(u(n)){i=[],e.set(n,i);for(let o=0;o<n.length;o++)i[o]=r(n[o]);return i}e.set(n,i);for(const o in n)h(n,o)&&(i[o]=r(n[o]));return i}else return n}return r(t)}function O(t,e,r){return u(t)?Z(t,e,r):T(t,e,r)}function T(t,e,r){const n=c(e,r);return Object.keys(t).forEach(o=>{s(e[o])?n[o]=c(t[o],r):n[o]=a(t[o])&&a(e[o])?O(t[o],e[o],r):c(e[o],r)}),n}function Z(t,e,r){if(u(e)){const n=c(e,r);return n.push(...c(t,r)),n}else return c(t,r)}function c(t,e){const{isDeepClone:r=!0}=e||{};return r?m(t):t}function x(t,e=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,n)},e)}}function F(t,e=500){let r=null;return function(...n){if(s(r))return r=Date.now(),t.apply(this,n);{const i=Date.now();if(i-r>=e)return r=i,t.apply(this,n)}}}function L(...t){return t.reduce((e,r)=>function(...n){return r(e(...n))})}function I(...t){return t.reduce((e,r)=>function(...n){return e(r(...n))})}function z(t){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(t)}function _(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function B(t){return/^[A-Z]+$/.test(t)}function K(t){return!s(t)&&/^[a-z]+$/.test(t)}function W(t){return/^\d+$/.test(t)}function q(t){return/^-?\d{1,3}\.\d{6}$/.test(t)}function G(t){return t===""}function H(t){return!s(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function J(t){return!s(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function Q(t){return!s(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function V(t){return/^[\dA-Z_]+$/.test(t)}function X(t){return/^[1-9]\d*$/.test(t)}function Y(t){return/^\d+$/.test(t)}function k(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function tt(t){return Array.isArray(t)?t:[t]}exports.castArray=tt;exports.compose=L;exports.composeRight=I;exports.debounce=x;exports.deepClone=m;exports.deepMerge=O;exports.error=E;exports.getRandomColor=y;exports.getRandomString=l;exports.hasChanged=D;exports.hasOwn=h;exports.isArray=u;exports.isBoolean=R;exports.isDate=g;exports.isDef=P;exports.isEmptyString=G;exports.isFunction=f;exports.isMap=C;exports.isNull=U;exports.isNumber=w;exports.isObject=a;exports.isPromise=M;exports.isRegExp=b;exports.isSet=$;exports.isString=j;exports.isSymbol=v;exports.isUndef=s;exports.isUndefined=N;exports.log=S;exports.objectToString=p;exports.throttle=F;exports.toTypeString=d;exports.validatorChineseOrEnglish=J;exports.validatorChineseOrEnglishOrNumber=H;exports.validatorEmail=_;exports.validatorLatitudeOrLongitude=q;exports.validatorLowerCase=K;exports.validatorMobilePhone=z;exports.validatorNumber=W;exports.validatorPositiveFloat=k;exports.validatorPositiveInt=X;exports.validatorPositiveIntAndZero=Y;exports.validatorUpperCase=B;exports.validatorUppercaseOrNumbersOrSpecial=Q;exports.validatorUppercaseOrNumbersOrUnderline=V;exports.warn=A;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A() {
|
|
2
2
|
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
3
3
|
}
|
|
4
4
|
function a(t) {
|
|
5
5
|
return t > 10 ? a(10) + a(t - 10) : Math.random().toString(36).padEnd(12, "0").slice(2, t + 2);
|
|
6
6
|
}
|
|
7
|
-
const p = Object.prototype.toString, d = (t) => p.call(t),
|
|
7
|
+
const p = Object.prototype.toString, d = (t) => p.call(t), w = (...t) => console.log(
|
|
8
8
|
`%c ${t[0]} `,
|
|
9
9
|
"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
|
|
10
10
|
t.slice(1).length > 0 ? t.slice(1) : ""
|
|
@@ -36,9 +36,9 @@ function m(t) {
|
|
|
36
36
|
return e(t);
|
|
37
37
|
}
|
|
38
38
|
function y(t, r, e) {
|
|
39
|
-
return f(t) ? O(t, r, e) :
|
|
39
|
+
return f(t) ? O(t, r, e) : $(t, r, e);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function $(t, r, e) {
|
|
42
42
|
const n = s(r, e);
|
|
43
43
|
return Object.keys(t).forEach((o) => {
|
|
44
44
|
c(r[o]) ? n[o] = s(t[o], e) : n[o] = u(t[o]) && u(r[o]) ? y(t[o], r[o], e) : s(r[o], e);
|
|
@@ -91,7 +91,7 @@ function I(t) {
|
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
function K(t) {
|
|
94
|
-
return /^
|
|
94
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
|
|
95
95
|
}
|
|
96
96
|
function B(t) {
|
|
97
97
|
return /^[A-Z]+$/.test(t);
|
|
@@ -140,7 +140,7 @@ export {
|
|
|
140
140
|
m as deepClone,
|
|
141
141
|
y as deepMerge,
|
|
142
142
|
S as error,
|
|
143
|
-
|
|
143
|
+
A as getRandomColor,
|
|
144
144
|
a as getRandomString,
|
|
145
145
|
F as hasChanged,
|
|
146
146
|
b as hasOwn,
|
|
@@ -161,7 +161,7 @@ export {
|
|
|
161
161
|
x as isSymbol,
|
|
162
162
|
c as isUndef,
|
|
163
163
|
R as isUndefined,
|
|
164
|
-
|
|
164
|
+
w as log,
|
|
165
165
|
p as objectToString,
|
|
166
166
|
z as throttle,
|
|
167
167
|
d as toTypeString,
|