@lntvow/utils 2.0.4 → 2.0.5

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 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):""),w=(...t)=>console.warn(...t),A=(...t)=>console.error(...t),E=t=>d(t)==="[object Map]",C=t=>d(t)==="[object Set]",g=t=>d(t)==="[object Date]",b=t=>d(t)==="[object RegExp]",f=t=>typeof t=="function",$=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/^([\w-])+@([\w-])+(.[\w-])+/.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=A;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=E;exports.isNull=U;exports.isNumber=$;exports.isObject=a;exports.isPromise=M;exports.isRegExp=b;exports.isSet=C;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=w;
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):""),w=(...t)=>console.warn(...t),A=(...t)=>console.error(...t),E=t=>d(t)==="[object Map]",C=t=>d(t)==="[object Set]",g=t=>d(t)==="[object Date]",b=t=>d(t)==="[object RegExp]",f=t=>typeof t=="function",$=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/^([\w-])+@([\w-])+(.[\w-])+/.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)}console.log(tt);const tt=10;function nt(t){return Array.isArray(t)?t:[t]}exports.castArray=nt;exports.compose=L;exports.composeRight=I;exports.debounce=x;exports.deepClone=m;exports.deepMerge=O;exports.error=A;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=E;exports.isNull=U;exports.isNumber=$;exports.isObject=a;exports.isPromise=M;exports.isRegExp=b;exports.isSet=C;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=w;
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
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), A = (...t) => console.log(
7
+ const p = Object.prototype.toString, d = (t) => p.call(t), E = (...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) : ""
11
- ), E = (...t) => console.warn(...t), S = (...t) => console.error(...t), j = (t) => d(t) === "[object Map]", C = (t) => d(t) === "[object Set]", g = (t) => d(t) === "[object Date]", h = (t) => d(t) === "[object RegExp]", l = (t) => typeof t == "function", M = (t) => typeof t == "number", D = (t) => typeof t == "string", x = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", N = (t) => u(t) && l(t.then) && l(t.catch), c = (t) => t == null, R = (t) => t === void 0, U = (t) => t === null, Z = (t) => t != null, P = (t) => typeof t == "boolean", f = Array.isArray, b = (t, r) => Object.hasOwn(t, r), F = (t, r) => t !== r;
11
+ ), S = (...t) => console.warn(...t), j = (...t) => console.error(...t), C = (t) => d(t) === "[object Map]", M = (t) => d(t) === "[object Set]", g = (t) => d(t) === "[object Date]", h = (t) => d(t) === "[object RegExp]", l = (t) => typeof t == "function", D = (t) => typeof t == "number", x = (t) => typeof t == "string", N = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", R = (t) => u(t) && l(t.then) && l(t.catch), c = (t) => t == null, U = (t) => t === void 0, Z = (t) => t === null, P = (t) => t != null, F = (t) => typeof t == "boolean", f = Array.isArray, b = (t, r) => Object.hasOwn(t, r), T = (t, r) => t !== r;
12
12
  function m(t) {
13
13
  const r = /* @__PURE__ */ new WeakMap();
14
14
  function e(n) {
@@ -55,7 +55,7 @@ function s(t, r) {
55
55
  const { isDeepClone: e = !0 } = r || {};
56
56
  return e ? m(t) : t;
57
57
  }
58
- function T(t, r = 500) {
58
+ function z(t, r = 500) {
59
59
  let e = null;
60
60
  return function(...n) {
61
61
  e && clearTimeout(e), e = setTimeout(() => {
@@ -63,7 +63,7 @@ function T(t, r = 500) {
63
63
  }, r);
64
64
  };
65
65
  }
66
- function z(t, r = 500) {
66
+ function L(t, r = 500) {
67
67
  let e = null;
68
68
  return function(...n) {
69
69
  if (c(e))
@@ -75,108 +75,110 @@ function z(t, r = 500) {
75
75
  }
76
76
  };
77
77
  }
78
- function L(...t) {
78
+ function _(...t) {
79
79
  return t.reduce((r, e) => function(...n) {
80
80
  return e(r(...n));
81
81
  });
82
82
  }
83
- function _(...t) {
83
+ function I(...t) {
84
84
  return t.reduce((r, e) => function(...n) {
85
85
  return r(e(...n));
86
86
  });
87
87
  }
88
- function I(t) {
88
+ function K(t) {
89
89
  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(
90
90
  t
91
91
  );
92
92
  }
93
- function K(t) {
93
+ function B(t) {
94
94
  return /^([\w-])+@([\w-])+(.[\w-])+/.test(t);
95
95
  }
96
- function B(t) {
96
+ function W(t) {
97
97
  return /^[A-Z]+$/.test(t);
98
98
  }
99
- function W(t) {
99
+ function q(t) {
100
100
  return !c(t) && /^[a-z]+$/.test(t);
101
101
  }
102
- function q(t) {
102
+ function G(t) {
103
103
  return /^\d+$/.test(t);
104
104
  }
105
- function G(t) {
105
+ function H(t) {
106
106
  return /^-?\d{1,3}\.\d{6}$/.test(t);
107
107
  }
108
- function H(t) {
108
+ function J(t) {
109
109
  return t === "";
110
110
  }
111
- function J(t) {
111
+ function Q(t) {
112
112
  return !c(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
113
113
  }
114
- function Q(t) {
114
+ function V(t) {
115
115
  return !c(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
116
116
  }
117
- function V(t) {
117
+ function X(t) {
118
118
  return !c(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
119
119
  }
120
- function X(t) {
120
+ function Y(t) {
121
121
  return /^[\dA-Z_]+$/.test(t);
122
122
  }
123
- function Y(t) {
123
+ function k(t) {
124
124
  return /^[1-9]\d*$/.test(t);
125
125
  }
126
- function k(t) {
126
+ function v(t) {
127
127
  return /^\d+$/.test(t);
128
128
  }
129
- function v(t) {
129
+ function tt(t) {
130
130
  return /^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t);
131
131
  }
132
- function tt(t) {
132
+ console.log($);
133
+ const $ = 10;
134
+ function nt(t) {
133
135
  return Array.isArray(t) ? t : [t];
134
136
  }
135
137
  export {
136
- tt as castArray,
137
- L as compose,
138
- _ as composeRight,
139
- T as debounce,
138
+ nt as castArray,
139
+ _ as compose,
140
+ I as composeRight,
141
+ z as debounce,
140
142
  m as deepClone,
141
143
  y as deepMerge,
142
- S as error,
143
- $ as getRandomColor,
144
+ j as error,
145
+ A as getRandomColor,
144
146
  a as getRandomString,
145
- F as hasChanged,
147
+ T as hasChanged,
146
148
  b as hasOwn,
147
149
  f as isArray,
148
- P as isBoolean,
150
+ F as isBoolean,
149
151
  g as isDate,
150
- Z as isDef,
151
- H as isEmptyString,
152
+ P as isDef,
153
+ J as isEmptyString,
152
154
  l as isFunction,
153
- j as isMap,
154
- U as isNull,
155
- M as isNumber,
155
+ C as isMap,
156
+ Z as isNull,
157
+ D as isNumber,
156
158
  u as isObject,
157
- N as isPromise,
159
+ R as isPromise,
158
160
  h as isRegExp,
159
- C as isSet,
160
- D as isString,
161
- x as isSymbol,
161
+ M as isSet,
162
+ x as isString,
163
+ N as isSymbol,
162
164
  c as isUndef,
163
- R as isUndefined,
164
- A as log,
165
+ U as isUndefined,
166
+ E as log,
165
167
  p as objectToString,
166
- z as throttle,
168
+ L as throttle,
167
169
  d as toTypeString,
168
- Q as validatorChineseOrEnglish,
169
- J as validatorChineseOrEnglishOrNumber,
170
- K as validatorEmail,
171
- G as validatorLatitudeOrLongitude,
172
- W as validatorLowerCase,
173
- I as validatorMobilePhone,
174
- q as validatorNumber,
175
- v as validatorPositiveFloat,
176
- Y as validatorPositiveInt,
177
- k as validatorPositiveIntAndZero,
178
- B as validatorUpperCase,
179
- V as validatorUppercaseOrNumbersOrSpecial,
180
- X as validatorUppercaseOrNumbersOrUnderline,
181
- E as warn
170
+ V as validatorChineseOrEnglish,
171
+ Q as validatorChineseOrEnglishOrNumber,
172
+ B as validatorEmail,
173
+ H as validatorLatitudeOrLongitude,
174
+ q as validatorLowerCase,
175
+ K as validatorMobilePhone,
176
+ G as validatorNumber,
177
+ tt as validatorPositiveFloat,
178
+ k as validatorPositiveInt,
179
+ v as validatorPositiveIntAndZero,
180
+ W as validatorUpperCase,
181
+ X as validatorUppercaseOrNumbersOrSpecial,
182
+ Y as validatorUppercaseOrNumbersOrUnderline,
183
+ S as warn
182
184
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",