@lntvow/utils 2.1.2 → 2.1.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/dist/index.cjs +1 -1
- package/dist/index.mjs +10 -6
- 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 f(t){return t>10?f(10)+f(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const g=Object.prototype.toString,u=t=>g.call(t);let p=null;function w(t){d(t)&&(p=t)}const A=(t,...n)=>{console.log(`%c ${t} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",n),p&&p(t,n)},C=(...t)=>console.warn(...t),E=(...t)=>console.error(...t),$=t=>u(t)==="[object Map]",j=t=>u(t)==="[object Set]",b=t=>u(t)==="[object Date]",h=t=>u(t)==="[object RegExp]",d=t=>typeof t=="function",v=t=>typeof t=="number",M=t=>typeof t=="string",N=t=>typeof t=="symbol",a=t=>t!==null&&typeof t=="object",U=t=>a(t)&&d(t.then)&&d(t.catch),s=t=>t==null,P=t=>t===void 0,R=t=>t===null,D=t=>t!=null,L=t=>typeof t=="boolean",l=Array.isArray,m=(t,n)=>Object.hasOwn(t,n),T=(t,n)=>t!==n;function O(t){const n=new WeakMap;function r(e){if(b(e))return new Date(e);if(h(e))return new RegExp(e);if(a(e)){if(n.has(e))return n.get(e);let i={};if(l(e)){i=[],n.set(e,i);for(let o=0;o<e.length;o++)i[o]=r(e[o]);return i}n.set(e,i);for(const o in e)m(e,o)&&(i[o]=r(e[o]));return i}else return e}return r(t)}function y(t,n,r){return l(t)?x(t,n,r):Z(t,n,r)}function Z(t,n,r){const e=c(n,r);return Object.keys(t).forEach(o=>{s(n[o])?e[o]=c(t[o],r):e[o]=a(t[o])&&a(n[o])?y(t[o],n[o],r):c(n[o],r)}),e}function x(t,n,r){if(l(n)){const e=c(n,r);return e.push(...c(t,r)),e}else return c(t,r)}function c(t,n){const{isDeepClone:r=!0}=n||{};return r?O(t):t}function F(t,n=500){let r=null;return function(...e){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,e)},n)}}function I(t,n=500){let r=null;return function(...e){if(s(r))return r=Date.now(),t.apply(this,e);{const i=Date.now();if(i-r>=n)return r=i,t.apply(this,e)}}}function z(...t){return t.reduce((n,r)=>function(...e){return r(n(...e))})}function _(...t){return t.reduce((n,r)=>function(...e){return n(r(...e))})}function B(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 K(t){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(t)}function W(t){return/^[A-Z]+$/.test(t)}function q(t){return!s(t)&&/^[a-z]+$/.test(t)}function G(t){return/^\d+$/.test(t)}function H(t){return/^-?\d{1,3}\.\d{6}$/.test(t)}function J(t){return t===""}function Q(t){return!s(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function V(t){return!s(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function X(t){return!s(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function Y(t){return/^[\dA-Z_]+$/.test(t)}function k(t){return/^[1-9]\d*$/.test(t)}function tt(t){return/^\d+$/.test(t)}function nt(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function et(t){return Array.isArray(t)?t:[t]}exports.castArray=et;exports.compose=z;exports.composeRight=_;exports.debounce=F;exports.deepClone=O;exports.deepMerge=y;exports.error=E;exports.getRandomColor=S;exports.getRandomString=f;exports.hasChanged=T;exports.hasOwn=m;exports.initLog=w;exports.isArray=l;exports.isBoolean=L;exports.isDate=b;exports.isDef=D;exports.isEmptyString=J;exports.isFunction=d;exports.isMap=$;exports.isNull=R;exports.isNumber=v;exports.isObject=a;exports.isPromise=U;exports.isRegExp=h;exports.isSet=j;exports.isString=M;exports.isSymbol=N;exports.isUndef=s;exports.isUndefined=P;exports.log=A;exports.objectToString=g;exports.throttle=I;exports.toTypeString=u;exports.validatorChineseOrEnglish=V;exports.validatorChineseOrEnglishOrNumber=Q;exports.validatorEmail=K;exports.validatorLatitudeOrLongitude=H;exports.validatorLowerCase=q;exports.validatorMobilePhone=B;exports.validatorNumber=G;exports.validatorPositiveFloat=nt;exports.validatorPositiveInt=k;exports.validatorPositiveIntAndZero=tt;exports.validatorUpperCase=W;exports.validatorUppercaseOrNumbersOrSpecial=X;exports.validatorUppercaseOrNumbersOrUnderline=Y;exports.warn=C;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function S(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function f(t){return t>10?f(10)+f(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const g=Object.prototype.toString,u=t=>g.call(t);let p=null;function w(t){d(t)&&(p=t)}const A=(t,...n)=>{console.log(`%c ${t} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",n.length===0?"":n.length===1?n[0]:n),p&&p(t,n)},C=(...t)=>console.warn(...t),E=(...t)=>console.error(...t),$=t=>u(t)==="[object Map]",j=t=>u(t)==="[object Set]",b=t=>u(t)==="[object Date]",h=t=>u(t)==="[object RegExp]",d=t=>typeof t=="function",v=t=>typeof t=="number",M=t=>typeof t=="string",N=t=>typeof t=="symbol",a=t=>t!==null&&typeof t=="object",U=t=>a(t)&&d(t.then)&&d(t.catch),s=t=>t==null,P=t=>t===void 0,R=t=>t===null,D=t=>t!=null,L=t=>typeof t=="boolean",l=Array.isArray,m=(t,n)=>Object.hasOwn(t,n),T=(t,n)=>t!==n;function O(t){const n=new WeakMap;function r(e){if(b(e))return new Date(e);if(h(e))return new RegExp(e);if(a(e)){if(n.has(e))return n.get(e);let i={};if(l(e)){i=[],n.set(e,i);for(let o=0;o<e.length;o++)i[o]=r(e[o]);return i}n.set(e,i);for(const o in e)m(e,o)&&(i[o]=r(e[o]));return i}else return e}return r(t)}function y(t,n,r){return l(t)?x(t,n,r):Z(t,n,r)}function Z(t,n,r){const e=c(n,r);return Object.keys(t).forEach(o=>{s(n[o])?e[o]=c(t[o],r):e[o]=a(t[o])&&a(n[o])?y(t[o],n[o],r):c(n[o],r)}),e}function x(t,n,r){if(l(n)){const e=c(n,r);return e.push(...c(t,r)),e}else return c(t,r)}function c(t,n){const{isDeepClone:r=!0}=n||{};return r?O(t):t}function F(t,n=500){let r=null;return function(...e){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,e)},n)}}function I(t,n=500){let r=null;return function(...e){if(s(r))return r=Date.now(),t.apply(this,e);{const i=Date.now();if(i-r>=n)return r=i,t.apply(this,e)}}}function z(...t){return t.reduce((n,r)=>function(...e){return r(n(...e))})}function _(...t){return t.reduce((n,r)=>function(...e){return n(r(...e))})}function B(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 K(t){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(t)}function W(t){return/^[A-Z]+$/.test(t)}function q(t){return!s(t)&&/^[a-z]+$/.test(t)}function G(t){return/^\d+$/.test(t)}function H(t){return/^-?\d{1,3}\.\d{6}$/.test(t)}function J(t){return t===""}function Q(t){return!s(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function V(t){return!s(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function X(t){return!s(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function Y(t){return/^[\dA-Z_]+$/.test(t)}function k(t){return/^[1-9]\d*$/.test(t)}function tt(t){return/^\d+$/.test(t)}function nt(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function et(t){return Array.isArray(t)?t:[t]}exports.castArray=et;exports.compose=z;exports.composeRight=_;exports.debounce=F;exports.deepClone=O;exports.deepMerge=y;exports.error=E;exports.getRandomColor=S;exports.getRandomString=f;exports.hasChanged=T;exports.hasOwn=m;exports.initLog=w;exports.isArray=l;exports.isBoolean=L;exports.isDate=b;exports.isDef=D;exports.isEmptyString=J;exports.isFunction=d;exports.isMap=$;exports.isNull=R;exports.isNumber=v;exports.isObject=a;exports.isPromise=U;exports.isRegExp=h;exports.isSet=j;exports.isString=M;exports.isSymbol=N;exports.isUndef=s;exports.isUndefined=P;exports.log=A;exports.objectToString=g;exports.throttle=I;exports.toTypeString=u;exports.validatorChineseOrEnglish=V;exports.validatorChineseOrEnglishOrNumber=Q;exports.validatorEmail=K;exports.validatorLatitudeOrLongitude=H;exports.validatorLowerCase=q;exports.validatorMobilePhone=B;exports.validatorNumber=G;exports.validatorPositiveFloat=nt;exports.validatorPositiveInt=k;exports.validatorPositiveIntAndZero=tt;exports.validatorUpperCase=W;exports.validatorUppercaseOrNumbersOrSpecial=X;exports.validatorUppercaseOrNumbersOrUnderline=Y;exports.warn=C;
|
package/dist/index.mjs
CHANGED
|
@@ -10,14 +10,18 @@ function E(t) {
|
|
|
10
10
|
a(t) && (d = t);
|
|
11
11
|
}
|
|
12
12
|
const S = (t, ...n) => {
|
|
13
|
-
console.log(
|
|
14
|
-
|
|
13
|
+
console.log(
|
|
14
|
+
`%c ${t} `,
|
|
15
|
+
"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
|
|
16
|
+
n.length === 0 ? "" : n.length === 1 ? n[0] : n
|
|
17
|
+
), d && d(t, n);
|
|
18
|
+
}, j = (...t) => console.warn(...t), C = (...t) => console.error(...t), M = (t) => f(t) === "[object Map]", D = (t) => f(t) === "[object Set]", h = (t) => f(t) === "[object Date]", b = (t) => f(t) === "[object RegExp]", a = (t) => typeof t == "function", x = (t) => typeof t == "number", N = (t) => typeof t == "string", R = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", U = (t) => u(t) && a(t.then) && a(t.catch), c = (t) => t == null, Z = (t) => t === void 0, P = (t) => t === null, F = (t) => t != null, L = (t) => typeof t == "boolean", l = Array.isArray, y = (t, n) => Object.hasOwn(t, n), T = (t, n) => t !== n;
|
|
15
19
|
function m(t) {
|
|
16
20
|
const n = /* @__PURE__ */ new WeakMap();
|
|
17
21
|
function e(r) {
|
|
18
|
-
if (b(r))
|
|
19
|
-
return new Date(r);
|
|
20
22
|
if (h(r))
|
|
23
|
+
return new Date(r);
|
|
24
|
+
if (b(r))
|
|
21
25
|
return new RegExp(r);
|
|
22
26
|
if (u(r)) {
|
|
23
27
|
if (n.has(r))
|
|
@@ -150,7 +154,7 @@ export {
|
|
|
150
154
|
E as initLog,
|
|
151
155
|
l as isArray,
|
|
152
156
|
L as isBoolean,
|
|
153
|
-
|
|
157
|
+
h as isDate,
|
|
154
158
|
F as isDef,
|
|
155
159
|
Q as isEmptyString,
|
|
156
160
|
a as isFunction,
|
|
@@ -159,7 +163,7 @@ export {
|
|
|
159
163
|
x as isNumber,
|
|
160
164
|
u as isObject,
|
|
161
165
|
U as isPromise,
|
|
162
|
-
|
|
166
|
+
b as isRegExp,
|
|
163
167
|
D as isSet,
|
|
164
168
|
N as isString,
|
|
165
169
|
R as isSymbol,
|