@lntvow/utils 1.8.23 → 1.8.24

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=1e3){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,n)},e)}}function F(t,e=1e3){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 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;
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare function composeRight(...fns: ((...args: any[]) => any)[]): (...a
19
19
  /**
20
20
  * @description 防抖函数
21
21
  * @param target 目标函数
22
- * @param wait 等待时间 默认 1000ms
22
+ * @param wait 等待时间 默认 500ms
23
23
  * @example debounce(() => console.log('debounce'), 500)
24
24
  */
25
25
  export declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
@@ -178,7 +178,7 @@ declare interface Options {
178
178
  /**
179
179
  * @description 节流函数
180
180
  * @param target 目标函数
181
- * @param wait 等待时间 默认 1000ms
181
+ * @param wait 等待时间 默认 500ms
182
182
  * @example throttle(() => console.log('hello world'), 500)
183
183
  */
184
184
  export declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
package/dist/index.mjs CHANGED
@@ -62,7 +62,7 @@ function s(n, e) {
62
62
  const { isDeepClone: r = !0 } = e || {};
63
63
  return r ? m(n) : n;
64
64
  }
65
- function F(n, e = 1e3) {
65
+ function F(n, e = 500) {
66
66
  let r = null;
67
67
  return function(...t) {
68
68
  r && clearTimeout(r), r = setTimeout(() => {
@@ -70,7 +70,7 @@ function F(n, e = 1e3) {
70
70
  }, e);
71
71
  };
72
72
  }
73
- function T(n, e = 1e3) {
73
+ function T(n, e = 500) {
74
74
  let r = null;
75
75
  return function(...t) {
76
76
  if (b(r))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "1.8.23",
3
+ "version": "1.8.24",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",