@lntvow/utils 1.7.12 → 1.7.13

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"});const m=require("vconsole");function O(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function u(t){return t>10?u(10)+u(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const S=Object.prototype.toString,f=t=>S.call(t),D=(...t)=>console.log(`%c ${t[0]}: `,"padding: 2px 1px; border-radius: 3px 3px 3px 3px; color: #fff; background: #000; font-weight: bold;",t.slice(1)),x=t=>console.warn(t),M=t=>console.error(t),R=t=>f(t)==="[object Map]",E=t=>f(t)==="[object Set]",h=t=>f(t)==="[object Date]",b=t=>f(t)==="[object RegExp]",g=t=>typeof t=="function",T=t=>typeof t=="string",N=t=>typeof t=="symbol",l=t=>t!==null&&typeof t=="object",A=t=>l(t)&&g(t.then)&&g(t.catch),w=t=>t==null,y=t=>t===null;function I(t){return t!=null}const a=Array.isArray,j=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),P=(t,n)=>t!==n;function C(t){const n=new WeakMap;function e(o){if(h(o))return new Date(o);if(b(o))return new RegExp(o);if(l(o)){if(n.has(o))return n.get(o);let i={};if(a(o)){i=[],n.set(o,i);for(let r=0;r<o.length;r++)i[r]=e(o[r]);return i}n.set(o,i);for(const r in o)j(o,r)&&(i[r]=e(o[r]));return i}else return o}return e(t)}function p(t,n,e){return a(t)?K(t,n,e):F(t,n,e)}function F(t,n,e){const o=s(n,e);return Object.keys(t).forEach(r=>{w(n[r])?o[r]=s(t[r],e):o[r]=l(t[r])&&l(n[r])?p(t[r],n[r],e):s(n[r],e)}),o}function K(t,n,e){return a(n)?s(t,e).concat(s(n,e)):s(n,e)}function s(t,n){const{isDeepClone:e=!0}=n||{};return e?C(t):t}function L(t,n=1e3){let e=null;return function(...o){e&&clearTimeout(e),e=setTimeout(()=>{t.apply(this,...o)},n)}}function U(t,n=1e3){let e=null;return function(...o){if(y(e))return e=Date.now(),t.apply(this,...o);{const i=Date.now();if(i-e>=n)return e=i,t.apply(this,...o)}}}let c={name:"LNTVOW_CONSOLE",time:3600,count:20};function V(t){c=p(c,t||{});const n=localStorage.getItem(c.name);if(!n)return;Date.now()-Number(n)>=1e3*c.time?localStorage.removeItem(c.name):new m}let d=0;function W(){d++,d>=c.count&&!localStorage.getItem(c.name)&&(localStorage.setItem(c.name,Date.now().toString()),new m)}const _={initConsole:V,showConsole:W};function $(...t){return t.reduce((n,e)=>function(...o){return e(n(...o))})}function q(...t){return t.reduce((n,e)=>function(...o){return n(e(...o))})}exports.compose=$;exports.composeRight=q;exports.debounce=L;exports.deepClone=C;exports.deepMerge=p;exports.error=M;exports.getRandomColor=O;exports.getRandomString=u;exports.hasChanged=P;exports.hasOwn=j;exports.isArray=a;exports.isDate=h;exports.isDef=I;exports.isFunction=g;exports.isMap=R;exports.isNull=y;exports.isObject=l;exports.isPromise=A;exports.isRegExp=b;exports.isSet=E;exports.isString=T;exports.isSymbol=N;exports.isUndef=w;exports.log=D;exports.nConsole=_;exports.objectToString=S;exports.throttle=U;exports.toTypeString=f;exports.warn=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("vconsole");function O(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function u(t){return t>10?u(10)+u(t-10):Math.random().toString(36).padEnd(12,"0").slice(2,t+2)}const S=Object.prototype.toString,f=t=>S.call(t),D=(...t)=>console.log(`%c ${t[0]}: `,"padding: 2px 1px; border-radius: 3px 3px 3px 3px; color: #fff; background: #000; font-weight: bold;",t.slice(1)),x=(...t)=>console.warn(...t),M=(...t)=>console.error(...t),R=t=>f(t)==="[object Map]",E=t=>f(t)==="[object Set]",h=t=>f(t)==="[object Date]",b=t=>f(t)==="[object RegExp]",g=t=>typeof t=="function",T=t=>typeof t=="string",N=t=>typeof t=="symbol",l=t=>t!==null&&typeof t=="object",A=t=>l(t)&&g(t.then)&&g(t.catch),w=t=>t==null,y=t=>t===null;function I(t){return t!=null}const a=Array.isArray,j=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),P=(t,n)=>t!==n;function C(t){const n=new WeakMap;function e(o){if(h(o))return new Date(o);if(b(o))return new RegExp(o);if(l(o)){if(n.has(o))return n.get(o);let i={};if(a(o)){i=[],n.set(o,i);for(let r=0;r<o.length;r++)i[r]=e(o[r]);return i}n.set(o,i);for(const r in o)j(o,r)&&(i[r]=e(o[r]));return i}else return o}return e(t)}function p(t,n,e){return a(t)?K(t,n,e):F(t,n,e)}function F(t,n,e){const o=s(n,e);return Object.keys(t).forEach(r=>{w(n[r])?o[r]=s(t[r],e):o[r]=l(t[r])&&l(n[r])?p(t[r],n[r],e):s(n[r],e)}),o}function K(t,n,e){return a(n)?s(t,e).concat(s(n,e)):s(n,e)}function s(t,n){const{isDeepClone:e=!0}=n||{};return e?C(t):t}function L(t,n=1e3){let e=null;return function(...o){e&&clearTimeout(e),e=setTimeout(()=>{t.apply(this,...o)},n)}}function U(t,n=1e3){let e=null;return function(...o){if(y(e))return e=Date.now(),t.apply(this,...o);{const i=Date.now();if(i-e>=n)return e=i,t.apply(this,...o)}}}let c={name:"LNTVOW_CONSOLE",time:3600,count:20};function V(t){c=p(c,t||{});const n=localStorage.getItem(c.name);if(!n)return;Date.now()-Number(n)>=1e3*c.time?localStorage.removeItem(c.name):new m}let d=0;function W(){d++,d>=c.count&&!localStorage.getItem(c.name)&&(localStorage.setItem(c.name,Date.now().toString()),new m)}const _={initConsole:V,showConsole:W};function $(...t){return t.reduce((n,e)=>function(...o){return e(n(...o))})}function q(...t){return t.reduce((n,e)=>function(...o){return n(e(...o))})}exports.compose=$;exports.composeRight=q;exports.debounce=L;exports.deepClone=C;exports.deepMerge=p;exports.error=M;exports.getRandomColor=O;exports.getRandomString=u;exports.hasChanged=P;exports.hasOwn=j;exports.isArray=a;exports.isDate=h;exports.isDef=I;exports.isFunction=g;exports.isMap=R;exports.isNull=y;exports.isObject=l;exports.isPromise=A;exports.isRegExp=b;exports.isSet=E;exports.isString=T;exports.isSymbol=N;exports.isUndef=w;exports.log=D;exports.nConsole=_;exports.objectToString=S;exports.throttle=U;exports.toTypeString=f;exports.warn=x;
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ export declare function deepClone<T = any>(target: T): T;
38
38
  */
39
39
  export declare function deepMerge(template: AnyObj, source: AnyObj, options?: Options): any;
40
40
 
41
- export declare const error: (msg: string) => void;
41
+ export declare const error: (...arg: unknown[]) => void;
42
42
 
43
43
  /**
44
44
  * @description 获取随机颜色
@@ -143,6 +143,6 @@ export declare function throttle(target: Function, wait?: number): (...args: any
143
143
 
144
144
  export declare const toTypeString: (value: unknown) => string;
145
145
 
146
- export declare const warn: (msg: string) => void;
146
+ export declare const warn: (...arg: unknown[]) => void;
147
147
 
148
148
  export { }
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ const h = Object.prototype.toString, l = (t) => h.call(t), T = (...t) => console
9
9
  `%c ${t[0]}: `,
10
10
  "padding: 2px 1px; border-radius: 3px 3px 3px 3px; color: #fff; background: #000; font-weight: bold;",
11
11
  t.slice(1)
12
- ), I = (t) => console.warn(t), N = (t) => console.error(t), A = (t) => l(t) === "[object Map]", K = (t) => l(t) === "[object Set]", b = (t) => l(t) === "[object Date]", w = (t) => l(t) === "[object RegExp]", p = (t) => typeof t == "function", L = (t) => typeof t == "string", P = (t) => typeof t == "symbol", f = (t) => t !== null && typeof t == "object", V = (t) => f(t) && p(t.then) && p(t.catch), S = (t) => t == null, y = (t) => t === null;
12
+ ), I = (...t) => console.warn(...t), N = (...t) => console.error(...t), A = (t) => l(t) === "[object Map]", K = (t) => l(t) === "[object Set]", b = (t) => l(t) === "[object Date]", w = (t) => l(t) === "[object RegExp]", p = (t) => typeof t == "function", L = (t) => typeof t == "string", P = (t) => typeof t == "symbol", f = (t) => t !== null && typeof t == "object", V = (t) => f(t) && p(t.then) && p(t.catch), S = (t) => t == null, y = (t) => t === null;
13
13
  function W(t) {
14
14
  return t != null;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "1.7.12",
3
+ "version": "1.7.13",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",