@lntvow/utils 1.8.24 → 2.0.0

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 S(){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 a=Object.prototype.toString,f=t=>a.call(t),w=(...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=>f(t)==="[object Map]",$=t=>f(t)==="[object Set]",g=t=>f(t)==="[object Date]",h=t=>f(t)==="[object RegExp]",p=t=>typeof t=="function",j=t=>typeof t=="string",M=t=>typeof t=="symbol",u=t=>t!==null&&typeof t=="object",U=t=>u(t)&&p(t.then)&&p(t.catch),c=t=>t==null,P=t=>t===void 0,b=t=>t===null;function N(t){return t!=null}function R(t){return typeof t=="boolean"}const d=Array.isArray,m=(t,e)=>Object.hasOwn(t,e),D=(t,e)=>t!==e;function O(t){const e=new WeakMap;function r(n){if(g(n))return new Date(n);if(h(n))return new RegExp(n);if(u(n)){if(e.has(n))return e.get(n);let s={};if(d(n)){s=[],e.set(n,s);for(let i=0;i<n.length;i++)s[i]=r(n[i]);return s}e.set(n,s);for(const i in n)m(n,i)&&(s[i]=r(n[i]));return s}else return n}return r(t)}function y(t,e,r){return d(t)?Z(t,e,r):T(t,e,r)}function T(t,e,r){const n=o(e,r);return Object.keys(t).forEach(i=>{c(e[i])?n[i]=o(t[i],r):n[i]=u(t[i])&&u(e[i])?y(t[i],e[i],r):o(e[i],r)}),n}function Z(t,e,r){if(d(e)){const n=o(e,r);return n.push(...o(t,r)),n}else return o(t,r)}function o(t,e){const{isDeepClone:r=!0}=e||{};return r?O(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(b(r))return r=Date.now(),t.apply(this,n);{const s=Date.now();if(s-r>=e)return r=s,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!c(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!c(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function J(t){return!c(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function Q(t){return!c(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 v(t){return Array.isArray(t)?t:[t]}exports.castArray=v;exports.compose=L;exports.composeRight=I;exports.debounce=x;exports.deepClone=O;exports.deepMerge=y;exports.error=E;exports.getRandomColor=S;exports.getRandomString=l;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=_;exports.isEmptyString=G;exports.isFunction=p;exports.isLatitudeOrLongitude=q;exports.isLowerCase=K;exports.isMap=C;exports.isMobilePhone=z;exports.isNull=b;exports.isNumber=W;exports.isObject=u;exports.isPositiveFloat=k;exports.isPositiveInt=X;exports.isPositiveIntAndZero=Y;exports.isPromise=U;exports.isRegExp=h;exports.isSet=$;exports.isString=j;exports.isSymbol=M;exports.isUndef=c;exports.isUndefined=P;exports.isUpperCase=B;exports.isUppercaseOrNumbersOrSpecial=Q;exports.isUppercaseOrNumbersOrUnderline=V;exports.log=w;exports.objectToString=a;exports.throttle=F;exports.toTypeString=f;exports.warn=A;
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 a=Object.prototype.toString,f=t=>a.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=>f(t)==="[object Map]",C=t=>f(t)==="[object Set]",g=t=>f(t)==="[object Date]",h=t=>f(t)==="[object RegExp]",p=t=>typeof t=="function",$=t=>typeof t=="string",j=t=>typeof t=="symbol",u=t=>t!==null&&typeof t=="object",M=t=>u(t)&&p(t.then)&&p(t.catch),o=t=>t==null,U=t=>t===void 0,P=t=>t===null;function N(t){return t!=null}function R(t){return typeof t=="boolean"}const d=Array.isArray,b=(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(h(n))return new RegExp(n);if(u(n)){if(e.has(n))return e.get(n);let s={};if(d(n)){s=[],e.set(n,s);for(let i=0;i<n.length;i++)s[i]=r(n[i]);return s}e.set(n,s);for(const i in n)b(n,i)&&(s[i]=r(n[i]));return s}else return n}return r(t)}function O(t,e,r){return d(t)?Z(t,e,r):T(t,e,r)}function T(t,e,r){const n=c(e,r);return Object.keys(t).forEach(i=>{o(e[i])?n[i]=c(t[i],r):n[i]=u(t[i])&&u(e[i])?O(t[i],e[i],r):c(e[i],r)}),n}function Z(t,e,r){if(d(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(o(r))return r=Date.now(),t.apply(this,n);{const s=Date.now();if(s-r>=e)return r=s,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!o(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!o(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function J(t){return!o(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function Q(t){return!o(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 v(t){return Array.isArray(t)?t:[t]}exports.castArray=v;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=b;exports.isArray=d;exports.isBoolean=R;exports.isChineseOrEnglish=J;exports.isChineseOrEnglishOrNumber=H;exports.isDate=g;exports.isDef=N;exports.isEmail=_;exports.isEmptyString=G;exports.isFunction=p;exports.isLatitudeOrLongitude=q;exports.isLowerCase=K;exports.isMap=E;exports.isMobilePhone=z;exports.isNull=P;exports.isNumber=W;exports.isObject=u;exports.isPositiveFloat=k;exports.isPositiveInt=X;exports.isPositiveIntAndZero=Y;exports.isPromise=M;exports.isRegExp=h;exports.isSet=C;exports.isString=$;exports.isSymbol=j;exports.isUndef=o;exports.isUndefined=U;exports.isUpperCase=B;exports.isUppercaseOrNumbersOrSpecial=Q;exports.isUppercaseOrNumbersOrUnderline=V;exports.log=S;exports.objectToString=a;exports.throttle=F;exports.toTypeString=f;exports.warn=w;
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- function A() {
1
+ function $() {
2
2
  return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
3
3
  }
4
4
  function p(n) {
5
5
  return n > 10 ? p(10) + p(n - 10) : Math.random().toString(36).padEnd(12, "0").slice(2, n + 2);
6
6
  }
7
- const g = Object.prototype.toString, f = (n) => g.call(n), E = (...n) => console.log(
7
+ const g = Object.prototype.toString, f = (n) => g.call(n), A = (...n) => console.log(
8
8
  `%c ${n[0]} `,
9
9
  "padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
10
10
  n.slice(1).length > 0 ? n.slice(1) : ""
11
- ), S = (...n) => console.warn(...n), j = (...n) => console.error(...n), C = (n) => f(n) === "[object Map]", M = (n) => f(n) === "[object Set]", a = (n) => f(n) === "[object Date]", h = (n) => f(n) === "[object RegExp]", l = (n) => typeof n == "function", D = (n) => typeof n == "string", x = (n) => typeof n == "symbol", u = (n) => n !== null && typeof n == "object", R = (n) => u(n) && l(n.then) && l(n.catch), c = (n) => n == null, U = (n) => n === void 0, b = (n) => n === null;
11
+ ), E = (...n) => console.warn(...n), S = (...n) => console.error(...n), j = (n) => f(n) === "[object Map]", C = (n) => f(n) === "[object Set]", a = (n) => f(n) === "[object Date]", h = (n) => f(n) === "[object RegExp]", l = (n) => typeof n == "function", M = (n) => typeof n == "string", D = (n) => typeof n == "symbol", u = (n) => n !== null && typeof n == "object", x = (n) => u(n) && l(n.then) && l(n.catch), c = (n) => n == null, R = (n) => n === void 0, U = (n) => n === null;
12
12
  function Z(n) {
13
13
  return n != null;
14
14
  }
15
15
  function N(n) {
16
16
  return typeof n == "boolean";
17
17
  }
18
- const d = Array.isArray, y = (n, e) => Object.hasOwn(n, e), P = (n, e) => n !== e;
19
- function m(n) {
18
+ const d = Array.isArray, b = (n, e) => Object.hasOwn(n, e), P = (n, e) => n !== e;
19
+ function y(n) {
20
20
  const e = /* @__PURE__ */ new WeakMap();
21
21
  function r(t) {
22
22
  if (a(t))
@@ -35,23 +35,23 @@ function m(n) {
35
35
  }
36
36
  e.set(t, i);
37
37
  for (const o in t)
38
- y(t, o) && (i[o] = r(t[o]));
38
+ b(t, o) && (i[o] = r(t[o]));
39
39
  return i;
40
40
  } else
41
41
  return t;
42
42
  }
43
43
  return r(n);
44
44
  }
45
- function w(n, e, r) {
46
- return d(n) ? $(n, e, r) : O(n, e, r);
45
+ function m(n, e, r) {
46
+ return d(n) ? O(n, e, r) : w(n, e, r);
47
47
  }
48
- function O(n, e, r) {
48
+ function w(n, e, r) {
49
49
  const t = s(e, r);
50
50
  return Object.keys(n).forEach((o) => {
51
- c(e[o]) ? t[o] = s(n[o], r) : t[o] = u(n[o]) && u(e[o]) ? w(n[o], e[o], r) : s(e[o], r);
51
+ c(e[o]) ? t[o] = s(n[o], r) : t[o] = u(n[o]) && u(e[o]) ? m(n[o], e[o], r) : s(e[o], r);
52
52
  }), t;
53
53
  }
54
- function $(n, e, r) {
54
+ function O(n, e, r) {
55
55
  if (d(e)) {
56
56
  const t = s(e, r);
57
57
  return t.push(...s(n, r)), t;
@@ -60,7 +60,7 @@ function $(n, e, r) {
60
60
  }
61
61
  function s(n, e) {
62
62
  const { isDeepClone: r = !0 } = e || {};
63
- return r ? m(n) : n;
63
+ return r ? y(n) : n;
64
64
  }
65
65
  function F(n, e = 500) {
66
66
  let r = null;
@@ -73,7 +73,7 @@ function F(n, e = 500) {
73
73
  function T(n, e = 500) {
74
74
  let r = null;
75
75
  return function(...t) {
76
- if (b(r))
76
+ if (c(r))
77
77
  return r = Date.now(), n.apply(this, t);
78
78
  {
79
79
  const i = Date.now();
@@ -144,13 +144,13 @@ export {
144
144
  z as compose,
145
145
  L as composeRight,
146
146
  F as debounce,
147
- m as deepClone,
148
- w as deepMerge,
149
- j as error,
150
- A as getRandomColor,
147
+ y as deepClone,
148
+ m as deepMerge,
149
+ S as error,
150
+ $ as getRandomColor,
151
151
  p as getRandomString,
152
152
  P as hasChanged,
153
- y as hasOwn,
153
+ b as hasOwn,
154
154
  d as isArray,
155
155
  N as isBoolean,
156
156
  J as isChineseOrEnglish,
@@ -162,27 +162,27 @@ export {
162
162
  l as isFunction,
163
163
  q as isLatitudeOrLongitude,
164
164
  B as isLowerCase,
165
- C as isMap,
165
+ j as isMap,
166
166
  _ as isMobilePhone,
167
- b as isNull,
167
+ U as isNull,
168
168
  W as isNumber,
169
169
  u as isObject,
170
170
  k as isPositiveFloat,
171
171
  X as isPositiveInt,
172
172
  Y as isPositiveIntAndZero,
173
- R as isPromise,
173
+ x as isPromise,
174
174
  h as isRegExp,
175
- M as isSet,
176
- D as isString,
177
- x as isSymbol,
175
+ C as isSet,
176
+ M as isString,
177
+ D as isSymbol,
178
178
  c as isUndef,
179
- U as isUndefined,
179
+ R as isUndefined,
180
180
  K as isUpperCase,
181
181
  Q as isUppercaseOrNumbersOrSpecial,
182
182
  V as isUppercaseOrNumbersOrUnderline,
183
- E as log,
183
+ A as log,
184
184
  g as objectToString,
185
185
  T as throttle,
186
186
  f as toTypeString,
187
- S as warn
187
+ E as warn
188
188
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "1.8.24",
3
+ "version": "2.0.0",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",