@wxhccc/es-util 2.1.0 → 2.1.1

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.
@@ -23,7 +23,7 @@ interface NodeOptions extends Options {
23
23
  hasParentKey?: boolean;
24
24
  returnObject?: boolean;
25
25
  }
26
- declare type Tree = TreeNode[] | {
26
+ type Tree = TreeNode[] | {
27
27
  [children: string]: TreeNode[];
28
28
  };
29
29
  /**
@@ -47,8 +47,8 @@ export declare function array2tree(array: Node[], options: TreeOptions & {
47
47
  export declare function array2tree<T = any>(array: Node[], options: TreeOptions & {
48
48
  createNode: AnyFunction<T>;
49
49
  }): T;
50
- declare type Nodes = Node[];
51
- declare type NodeMap = {
50
+ type Nodes = Node[];
51
+ type NodeMap = {
52
52
  [id: string]: Node;
53
53
  };
54
54
  /**
@@ -79,7 +79,7 @@ export interface AnalyseTreeData<T extends TreeNode = TreeNode> {
79
79
  keyNodeMap: Record<string, TreeKeyNode>;
80
80
  disabledKeys: StrOrNum[];
81
81
  }
82
- declare type AnalyseTreeModule = keyof AnalyseTreeData;
82
+ type AnalyseTreeModule = keyof AnalyseTreeData;
83
83
  interface TreeAnalyseOptions extends Omit<Options, 'parentKey'> {
84
84
  disabledKey?: string;
85
85
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -25,14 +25,31 @@ function array2tree(array, options = {}) {
25
25
  (typeof parentRefKey === 'string' ? parentRefKey : '_parent');
26
26
  const nodeMap = {};
27
27
  const treeNodes = [];
28
- utils.isArr(array) &&
29
- array.forEach((item) => {
30
- !utils.hasOwnProp(nodeMap, item[id]) &&
31
- (nodeMap[item[id]] = Object.assign({}, item, createNode(children)));
32
- utils.hasOwnProp(nodeMap, item[pid]) &&
33
- nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
34
- !item[pid] && treeNodes.push(nodeMap[item[id]]);
35
- });
28
+ if (utils.isArr(array)) {
29
+ const unsortChildren = [];
30
+ const transform = (items) => {
31
+ items.forEach((item) => {
32
+ if (!utils.hasOwnProp(nodeMap, item[id])) {
33
+ nodeMap[item[id]] = { ...item, ...createNode(children) };
34
+ }
35
+ if (!item[pid]) {
36
+ treeNodes.push(nodeMap[item[id]]);
37
+ }
38
+ else if (utils.hasOwnProp(nodeMap, item[pid])) {
39
+ nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
40
+ }
41
+ else {
42
+ unsortChildren.push(item);
43
+ }
44
+ });
45
+ };
46
+ transform(array);
47
+ console.log(1111, unsortChildren);
48
+ // 如果有父节点顺序在后的,再循环一次
49
+ if (unsortChildren.length) {
50
+ transform(unsortChildren);
51
+ }
52
+ }
36
53
  if (utils.isFn(createRoot)) {
37
54
  return createRoot(treeNodes);
38
55
  }
@@ -1,4 +1,4 @@
1
- export declare type TimeUnitShort = 'd' | 'h' | 'm' | 's';
1
+ export type TimeUnitShort = 'd' | 'h' | 'm' | 's';
2
2
  export interface DurationDetail {
3
3
  d?: number;
4
4
  h?: number;
@@ -9,7 +9,7 @@ export interface EventPayload<T = any> {
9
9
  /** which emitter can recived the event */
10
10
  targetEmitterName?: string;
11
11
  }
12
- export declare type WatchersMap = Map<string | symbol, Set<AnyFunction>>;
12
+ export type WatchersMap = Map<string | symbol, Set<AnyFunction>>;
13
13
  export interface ConfigOptions {
14
14
  /** the name of current emitter */
15
15
  name?: string;
@@ -30,8 +30,8 @@ export declare const NOMETHOD: unique symbol;
30
30
  */
31
31
  export declare function eventTargetEmitter(options?: ConfigOptions): {
32
32
  name: string | undefined;
33
- rootEventListener: <T = any>(payload: EventPayload<T>) => void;
34
- on: <T_1>(method: string | symbol, listener: (data: T_1) => any, options?: BindOptions) => void;
33
+ rootEventListener: AnyFunction<any>;
34
+ on: <T>(method: string | symbol, listener: (data: T) => any, options?: BindOptions) => void;
35
35
  off: (method: string | symbol, callback?: AnyFunction, options?: BindOptions) => void;
36
36
  emit: (methodOrPayload: string | EventPayload<any>, data?: any, target?: string | undefined) => void;
37
37
  createPayload: (methodOrPayload: string | EventPayload, data?: any, target?: string) => EventPayload<any>;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  const { hasOwnProperty, toString } = Object.prototype;
@@ -33,14 +33,31 @@ function array2tree(array, options = {}) {
33
33
  (typeof parentRefKey === 'string' ? parentRefKey : '_parent');
34
34
  const nodeMap = {};
35
35
  const treeNodes = [];
36
- isArr(array) &&
37
- array.forEach((item) => {
38
- !hasOwnProp(nodeMap, item[id]) &&
39
- (nodeMap[item[id]] = Object.assign({}, item, createNode(children)));
40
- hasOwnProp(nodeMap, item[pid]) &&
41
- nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
42
- !item[pid] && treeNodes.push(nodeMap[item[id]]);
43
- });
36
+ if (isArr(array)) {
37
+ const unsortChildren = [];
38
+ const transform = (items) => {
39
+ items.forEach((item) => {
40
+ if (!hasOwnProp(nodeMap, item[id])) {
41
+ nodeMap[item[id]] = { ...item, ...createNode(children) };
42
+ }
43
+ if (!item[pid]) {
44
+ treeNodes.push(nodeMap[item[id]]);
45
+ }
46
+ else if (hasOwnProp(nodeMap, item[pid])) {
47
+ nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
48
+ }
49
+ else {
50
+ unsortChildren.push(item);
51
+ }
52
+ });
53
+ };
54
+ transform(array);
55
+ console.log(1111, unsortChildren);
56
+ // 如果有父节点顺序在后的,再循环一次
57
+ if (unsortChildren.length) {
58
+ transform(unsortChildren);
59
+ }
60
+ }
44
61
  if (isFn(createRoot)) {
45
62
  return createRoot(treeNodes);
46
63
  }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -37,14 +37,31 @@ function array2tree(array, options = {}) {
37
37
  (typeof parentRefKey === 'string' ? parentRefKey : '_parent');
38
38
  const nodeMap = {};
39
39
  const treeNodes = [];
40
- isArr(array) &&
41
- array.forEach((item) => {
42
- !hasOwnProp(nodeMap, item[id]) &&
43
- (nodeMap[item[id]] = Object.assign({}, item, createNode(children)));
44
- hasOwnProp(nodeMap, item[pid]) &&
45
- nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
46
- !item[pid] && treeNodes.push(nodeMap[item[id]]);
47
- });
40
+ if (isArr(array)) {
41
+ const unsortChildren = [];
42
+ const transform = (items) => {
43
+ items.forEach((item) => {
44
+ if (!hasOwnProp(nodeMap, item[id])) {
45
+ nodeMap[item[id]] = { ...item, ...createNode(children) };
46
+ }
47
+ if (!item[pid]) {
48
+ treeNodes.push(nodeMap[item[id]]);
49
+ }
50
+ else if (hasOwnProp(nodeMap, item[pid])) {
51
+ nodeMap[item[pid]][children].push(Object.assign(nodeMap[item[id]], pRefKey ? { [pRefKey]: nodeMap[item[pid]] } : {}));
52
+ }
53
+ else {
54
+ unsortChildren.push(item);
55
+ }
56
+ });
57
+ };
58
+ transform(array);
59
+ console.log(1111, unsortChildren);
60
+ // 如果有父节点顺序在后的,再循环一次
61
+ if (unsortChildren.length) {
62
+ transform(unsortChildren);
63
+ }
64
+ }
48
65
  if (isFn(createRoot)) {
49
66
  return createRoot(treeNodes);
50
67
  }
package/dist/index.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EsUtil={})}(this,(function(e){"use strict";const{hasOwnProperty:t,toString:n}=Object.prototype,r=(e,t)=>{Object.keys(e).forEach(((n,r)=>t(n,e[n],r)))},s=e=>"function"==typeof e,i=Array.isArray,o=e=>{const t=(r=e,n.call(r)).match(/^\[object (.*)\]$/);var r;return t?t[1]:""},a=e=>"Object"===o(e),c=(e,n)=>t.call(e,n);function l(e,t=[]){return{[e]:t}}const d=/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;const u={telphone:{startCharIndex:-8,endCharIndex:-5},idcard:{startCharIndex:-12,endCharIndex:-5}};async function f(e){try{return[null,await e]}catch(e){return[e,void 0]}}const p=function(e,t){const{wrap:n,lock:r,syncRefHandle:o}={...t};let a,c,l=!1,d=!1;const u=e=>{if(c){const[t,n]=c;t[n]=e}a&&a(e)};if(r){const e=e=>i(e)&&2===e.length;e(r)?c=r:s(r)&&(a=r,e(o)&&(c=o)),l=!(!a&&!c),l&&(d=!!c&&!!c[0][c[1]])}let p;if(s(e)){const t=d?Promise.resolve(void 0):e();p=n?f(t):t}else p=n?f(e):e;return p instanceof Promise&&l&&!d&&(u(!0),p.finally((()=>u(!1)))),p};function m(e="",t){try{return JSON.parse(e)}catch(e){return t}}const h=e=>""===e||null==e,y=(e,t)=>{const n={};return r(e,((e,r)=>{h(r)||(t?i(r)?n[e]=r.map((e=>a(e)?y(e):e)):n[e]=a(r)?y(r):r:n[e]=r)})),n},g=e=>{if(null!==e){if(i(e))return e.map(g);if(a(e)){const t={};return r(e,((e,n)=>{t[e]=g(n)})),t}return e}},b=(e,t,n)=>{const o=Object.keys(t),a={},c={};r(e,(t=>{o.includes(t)?a[t]=e[t]:c[t]=e[t]}));const l=Object.keys(a);if(0===l.length)return e;const{filterNullable:d,dateFormat:u}={filterNullable:!0,...n},f=l.reduce(((e,n)=>{const r=a[n],o=t[n];if(!r||!o)return e;if("join"===o||"pop"===o)i(r)&&r.length&&(e[n]="join"===o?r.join(","):r.slice(-1)[0]);else if(2===o.length||3===o.length){if(!r||2!==r.length)return e;const[t,n,i]=o,[a,c]=r;Object.assign(e,{[t]:s(u)?u(a,i):a,[n]:s(u)?u(c,i):c})}return e}),{}),p={...c,...f};return d?y(p):p},M=e=>"string"==typeof e,j=Symbol("NOMETHOD");function x(e){const t=new Map([[j,new Set]]),{name:n,customHanlderCreator:r}=e||{},i=s(r)?r(t):null,o=/\|-[a-z]+-\|/,a=(e,...t)=>{try{e(...t)}catch(e){console.error(e)}},c=s(i)?i:e=>{const{method:r,data:s,originEmitterName:i,targetEmitterName:c}=e||[];if(r&&"string"==typeof r){const e=[];t.forEach(((t,n)=>{if("string"==typeof n&&n.startsWith(r)){const[,r]=n.split(o);r&&i&&r!==i||e.push(...t)}})),!e.length||n&&c&&n!==c||e.forEach((e=>a(e,s)))}const l=t.get(j);l&&l.forEach((t=>a(t,s,e)))},l=(e,t)=>{const{limitFrom:n="",namespace:r=""}=t||{};return(n||r)&&"string"==typeof e?`${e}|-from-|${n}|-ns-|${r}`:e},d=(e,t,r)=>M(e)?{method:e,data:t,...r&&M(r)?{targetEmitterName:r}:{},...n&&M(n)?{originEmitterName:n}:{}}:e;return{name:n,rootEventListener:c,on:(e,n,r)=>{if("symbol"==typeof e&&e!==j)return;const s=l(e,r);t.has(s)||t.set(s,new Set);t.get(s)?.add(n)},off:(e,n,r)=>{if("symbol"==typeof e&&e!==j)return;const{namespace:s}=r||{};if(s&&!e)return void t.forEach(((e,n)=>{"string"==typeof n&&n.endsWith(s)&&t.delete(n)}));const i=l(e,r);n?t.get(i)?.delete(n):t.delete(i)},emit:(...e)=>{const t=d(...e);c(t)},createPayload:d,removeAllListeners:()=>{t.clear()},getMethodNames:e=>{if(!e){const e=[];return t.forEach(((t,n)=>M(n)&&e.push(n.split(o)))),e}const n=[];return t.forEach(((e,t)=>M(t)&&n.push(t))),n},getListeners:(e,n)=>{if("symbol"==typeof e)return e===j?Array.from(t.get(j)||[]):[];const r=l(e,n),s=t.get(r);return s?Array.from(s):[]}}}e.ChinaIdCardValid=function(e){const t=e.toString().toUpperCase();return d.test(t)&&["11","12","13","14","15","21","22","23","31","32","33","34","35","36","37","41","42","43","44","45","46","50","51","52","53","54","61","62","63","64","65","71","81","82","91"].includes(t.substr(0,2))&&(()=>{if(18===t.length){const e=t.split(""),n=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2],r=[1,0,"X",9,8,7,6,5,4,3,2];let s=0,i=0,o=0;for(let t=0;t<17;t++)i=parseInt(e[t]),o=n[t],s+=i*o;return r[s%11].toString()===e[17]}return!0})()},e.NOMETHOD=j,e.array2tree=function(e,t={}){const{primaryKey:n,parentKey:r,childrenKey:o,createRoot:a,parentRefKey:d}={primaryKey:"id",parentKey:"pid",childrenKey:"children",createRoot:!1,parentRefKey:!1,...t},u=d&&("string"==typeof d?d:"_parent"),f={},p=[];return i(e)&&e.forEach((e=>{!c(f,e[n])&&(f[e[n]]=Object.assign({},e,l(o))),c(f,e[r])&&f[e[r]][o].push(Object.assign(f[e[n]],u?{[u]:f[e[r]]}:{})),!e[r]&&p.push(f[e[n]])})),s(a)?a(p):a?{[o]:p}:p},e.awaitWrapper=f,e.b64UriDecode=e=>decodeURIComponent(window.atob(e)),e.b64UriEncode=e=>window.btoa(encodeURIComponent(e)),e.byteStringify=function(e,t){const n=Object.assign({standard:"jedec",unitLvl:"auto",precision:1,detail:!1},t),{standard:r,unitLvl:s,precision:o,detail:a}=n;let c=parseFloat(e);if(!Number.isFinite(c))return;const l=c<0?-1:1;c=Math.abs(c);const{base:d,unitMap:u}=((e,t)=>{const n={B:{expMax:0,units:{metric:"B",iec:"B",jedec:"B"}},K:{expMax:1,units:{metric:"kB",iec:"KiB",jedec:"KB"}},M:{expMax:2,units:{metric:"MB",iec:"MiB",jedec:"MB"}},G:{expMax:3,units:{metric:"GB",iec:"GiB",jedec:"GB"}},T:{expMax:4,units:{metric:"TB",iec:"TiB",jedec:"TB"}},P:{expMax:5,units:{metric:"PB",iec:"PiB",jedec:"PB"}},E:{expMax:6,units:{metric:"EB",iec:"EiB",jedec:"EB"}},Z:{expMax:7,units:{metric:"ZB",iec:"ZiB",jedec:"ZB"}},Y:{expMax:8,units:{metric:"YB",iec:"YiB",jedec:"YB"}}},r={metric:1e3,iec:1024,jedec:1024};return{base:r[e]||r.jedec,unitMap:n[t]||Object.values(n)}})(r,s),f=e=>Number.isInteger(e)?e:e.toFixed(o);let p="",m=0;if(i(u))u.some((e=>{const t=Math.pow(d,e.expMax),n=c/t;return!(n>d)&&(p=e.units[r],m=f(n*l),!0)}));else{const e=Math.pow(d,u.expMax);p=u.units[r];m=f(c/e*l)}return a?{value:m,unit:p}:`${m} ${p}`},e.checkoutBy=function(e,t,n){return a(e)?i(t)?t.map((t=>e[t])):t&&a(t)?Object.keys(t).map((r=>{const s=t[r];return a(e[r])&&a(s)?n?n({},e[r],s):Object.assign({},e[r],s):s||e[r]})):Object.values(e):[]},e.createRAFTimer=e=>{const{autoStopWhenNoTask:t,autoStartWhenAddTask:n}={...e};let r=0,s=!0,i=0,o=0,a=[],c=!1;const l=e=>{const n=e-(o||e);o=e,i+=n,c&&(a=a.filter((e=>!e.needClear)),c=!1),!t||a.length?(a.forEach((e=>{const{callback:t,maxTime:r,runTime:s,elapsed:o,interval:a,needClear:l}=e;if(!l){if(r&&s>=r)return e.needClear=!0,void(c=!0);if(o>=a){try{t(i)}catch(e){}e.elapsed=0,e.runTime+=1}else e.elapsed+=n}})),r=window.requestAnimationFrame(l)):s=!0},d=()=>{r=window.requestAnimationFrame(l),s=!1},u=()=>{window.cancelAnimationFrame(r),s=!0};return{start:d,stop:u,pauseToggle:()=>{s?d():u()},addTask:(e,t,r)=>{e&&(n&&s&&d(),a.push({callback:e,elapsed:0,interval:t,maxTime:r,runTime:0}))},removeTask:e=>{a=a.filter((t=>t.callback!==e))},isPaused:()=>s}},e.eventTargetEmitter=x,e.filterNullable=y,e.formParamsSwitch=b,e.formParamsSwitchCreator=e=>(t,n,r)=>b(t,n,{dateFormat:e,...r}),e.formulaValidate=function(e,t){return e=e.replace(/\s/g,""),!/[+\-*/]{2,}/.test(e)&&!/\(\)/.test(e)&&!/\([+\-*/]/.test(e)&&!/[+\-*/]\)/.test(e)&&!/[^+\-*/]\(/.test(e)&&!/\)[^+\-*/]/.test(e)&&(()=>{const t=[];for(let n,r=0;r<e.length;r++)if(n=e.charAt(r),"("===n)t.push("(");else if(")"===n){if(!(t.length>0))return!1;t.pop()}return!t.length})()&&(!i(t)||(n=t,e.replace(/[()+\-*/]{1,}/g,"`").split("`").every((e=>!/[A-Z]/i.test(e)||n.includes(e)))));var n},e.isNullable=h,e.mapToObject=function(e,t="key",n="value"){const r={};return i(e)&&t&&n&&[t,n].every((e=>["string","function"].includes(typeof e)))&&e.forEach(((e,s)=>{const i="string"==typeof t?e[t]:t(e,s),o="string"==typeof n?e[n]:n(e,s);["string","number"].includes(typeof i)&&(r[i]=o)})),r},e.maskData=function(e,t){if("string"!=typeof e||!e)return"";const n=t&&t.mode&&u[t.mode]?u[t.mode]:{},{maskWith:r,startCharIndex:s=0,endCharIndex:i,startFrom:o,endUntil:a}={maskWith:"*",...n,...t};let c=e,l="",d="";const f=o?e.indexOf(o):-1;if(f>-1){const t=f+o.length;c=c.slice(t),l=e.slice(0,t)}const p=a?e.lastIndexOf(a):-1;p>-1&&(c=c.slice(0,p),d=e.slice(p));const m=c.split(""),h=[l],y=m.length,g=[s>=0?s:y+s,void 0!==i?i>=0?i:y+i:y-1];let[b,M]=g;return M=M>0&&M<y?M:y-1,b=b>=0&&b<=M?b:0,m.forEach(((e,t)=>{h.push(t>=b&&t<=M?r:e)})),h.push(d),h.join("")},e.pageCommunicate=function(e){const{messageHanlder:t,currentPage:n}=e||{},{emit:r,on:s,off:i,createPayload:o,removeAllListeners:a}=x({name:n,customHanlderCreator:t}),c=e=>r(e.data);let l;const d=window.localStorage,u="PAGE_COMMUNICATE_CHANNEL";if(void 0!==typeof window.BroadcastChannel)l=new BroadcastChannel(u),l.addEventListener("message",c);else{const e=()=>{const e=m(d.getItem(u)||"");e&&r(e)};window.addEventListener("storage",e)}return{on:s,off:i,send:(...e)=>{const t=o(...e);if(l)l.postMessage(t);else{const e=JSON.stringify({...t,ts:+new Date});d.setItem(u,e)}},destory:()=>{a(),l?l.close():d.removeItem(u)}}},e.pickRenameKeys=function(e,t){if(!(e&&a(e)&&t&&a(t)))return;const n={};for(const r in e)r in t&&(n[t[r]]=e[r]);return n},e.safeJsonParse=m,e.secondsToDuration=(e,t="h")=>{const n=Number.isInteger(e)?e:Math.round(e),r={s:n%60};switch(t){case"m":r.m=Math.floor(n/60);break;case"h":r.m=Math.floor(n%3600/60),r.h=Math.floor(n/3600);break;case"d":r.m=Math.floor(n%3600/60),r.h=Math.floor(n%86400/3600),r.d=Math.floor(n/3600/24)}return r},e.switchNullToUndefined=g,e.tree2array=function(e,t={}){const{primaryKey:n,parentKey:r,childrenKey:s,hasParentKey:o,returnObject:a}=Object.assign({hasParentKey:!0,primaryKey:"id",parentKey:"pid",childrenKey:"children",returnObject:!1},t),c=a?{}:[];return i(e)||"object"==typeof e?(function e(t,l,d=!1){const u=o?{}:{[r]:l};if(!d){const e=Object.assign(u,function(e,t){const n={};for(const r in e)r!==t&&(n[r]=e[r]);return n}(t,s));a?c[t[n]]=e:c.push(e)}i(t[s])&&t[s].length&&t[s].forEach((r=>e(r,t[n])))}(i(e)?l(s,e):e,null,!0),c):c},e.treeAnalyse=function(e,t,n){const r={nodes:[],childKeysMaps:{},keyNodeMap:{},disabledKeys:[]},s=Array.isArray(n)?n:["nodes","keyNodeMap","childKeysMaps","disabledKeys"],{primaryKey:i,labelKey:o,disabledKey:a,childrenKey:c}={primaryKey:"id",labelKey:"name",childrenKey:"children",disabledKey:"disabled",...t},[l,d,u,f]=Object.keys(r).map((e=>s.includes(e))),p=(e,t)=>{e.forEach((e=>{const{[i]:n,[o]:s,[c]:m,[a]:h}=e;let y;l&&r.nodes.push(e),u&&void 0!==n&&(y={keyVlaue:n,keyLabel:s,parent:t,children:[]},t?.children.push(y),r.keyNodeMap[n]=y),f&&h&&void 0!==n&&r.disabledKeys.push(n),Array.isArray(m)&&m.length&&(d&&(r.childKeysMaps[n]=m.map((e=>e[i]))),p(m,y))}))};return e&&p(e),r},e.wp=p,Object.defineProperty(e,"__esModule",{value:!0})}));
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EsUtil={})}(this,(function(e){"use strict";const{hasOwnProperty:t,toString:n}=Object.prototype,r=(e,t)=>{Object.keys(e).forEach(((n,r)=>t(n,e[n],r)))},s=e=>"function"==typeof e,o=Array.isArray,i=e=>{const t=(r=e,n.call(r)).match(/^\[object (.*)\]$/);var r;return t?t[1]:""},a=e=>"Object"===i(e),c=(e,n)=>t.call(e,n);function l(e,t=[]){return{[e]:t}}const d=/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;const u={telphone:{startCharIndex:-8,endCharIndex:-5},idcard:{startCharIndex:-12,endCharIndex:-5}};async function f(e){try{return[null,await e]}catch(e){return[e,void 0]}}const p=function(e,t){const{wrap:n,lock:r,syncRefHandle:i}={...t};let a,c,l=!1,d=!1;const u=e=>{if(c){const[t,n]=c;t[n]=e}a&&a(e)};if(r){const e=e=>o(e)&&2===e.length;e(r)?c=r:s(r)&&(a=r,e(i)&&(c=i)),l=!(!a&&!c),l&&(d=!!c&&!!c[0][c[1]])}let p;if(s(e)){const t=d?Promise.resolve(void 0):e();p=n?f(t):t}else p=n?f(e):e;return p instanceof Promise&&l&&!d&&(u(!0),p.finally((()=>u(!1)))),p};function m(e="",t){try{return JSON.parse(e)}catch(e){return t}}const h=e=>""===e||null==e,y=(e,t)=>{const n={};return r(e,((e,r)=>{h(r)||(t?o(r)?n[e]=r.map((e=>a(e)?y(e):e)):n[e]=a(r)?y(r):r:n[e]=r)})),n},g=e=>{if(null!==e){if(o(e))return e.map(g);if(a(e)){const t={};return r(e,((e,n)=>{t[e]=g(n)})),t}return e}},b=(e,t,n)=>{const i=Object.keys(t),a={},c={};r(e,(t=>{i.includes(t)?a[t]=e[t]:c[t]=e[t]}));const l=Object.keys(a);if(0===l.length)return e;const{filterNullable:d,dateFormat:u}={filterNullable:!0,...n},f=l.reduce(((e,n)=>{const r=a[n],i=t[n];if(!r||!i)return e;if("join"===i||"pop"===i)o(r)&&r.length&&(e[n]="join"===i?r.join(","):r.slice(-1)[0]);else if(2===i.length||3===i.length){if(!r||2!==r.length)return e;const[t,n,o]=i,[a,c]=r;Object.assign(e,{[t]:s(u)?u(a,o):a,[n]:s(u)?u(c,o):c})}return e}),{}),p={...c,...f};return d?y(p):p},M=e=>"string"==typeof e,j=Symbol("NOMETHOD");function x(e){const t=new Map([[j,new Set]]),{name:n,customHanlderCreator:r}=e||{},o=s(r)?r(t):null,i=/\|-[a-z]+-\|/,a=(e,...t)=>{try{e(...t)}catch(e){console.error(e)}},c=s(o)?o:e=>{const{method:r,data:s,originEmitterName:o,targetEmitterName:c}=e||[];if(r&&"string"==typeof r){const e=[];t.forEach(((t,n)=>{if("string"==typeof n&&n.startsWith(r)){const[,r]=n.split(i);r&&o&&r!==o||e.push(...t)}})),!e.length||n&&c&&n!==c||e.forEach((e=>a(e,s)))}const l=t.get(j);l&&l.forEach((t=>a(t,s,e)))},l=(e,t)=>{const{limitFrom:n="",namespace:r=""}=t||{};return(n||r)&&"string"==typeof e?`${e}|-from-|${n}|-ns-|${r}`:e},d=(e,t,r)=>M(e)?{method:e,data:t,...r&&M(r)?{targetEmitterName:r}:{},...n&&M(n)?{originEmitterName:n}:{}}:e;return{name:n,rootEventListener:c,on:(e,n,r)=>{if("symbol"==typeof e&&e!==j)return;const s=l(e,r);t.has(s)||t.set(s,new Set);const o=t.get(s);o?.add(n)},off:(e,n,r)=>{if("symbol"==typeof e&&e!==j)return;const{namespace:s}=r||{};if(s&&!e)return void t.forEach(((e,n)=>{"string"==typeof n&&n.endsWith(s)&&t.delete(n)}));const o=l(e,r);n?t.get(o)?.delete(n):t.delete(o)},emit:(...e)=>{const t=d(...e);c(t)},createPayload:d,removeAllListeners:()=>{t.clear()},getMethodNames:e=>{if(!e){const e=[];return t.forEach(((t,n)=>M(n)&&e.push(n.split(i)))),e}const n=[];return t.forEach(((e,t)=>M(t)&&n.push(t))),n},getListeners:(e,n)=>{if("symbol"==typeof e)return e===j?Array.from(t.get(j)||[]):[];const r=l(e,n),s=t.get(r);return s?Array.from(s):[]}}}e.ChinaIdCardValid=function(e){const t=e.toString().toUpperCase();return d.test(t)&&["11","12","13","14","15","21","22","23","31","32","33","34","35","36","37","41","42","43","44","45","46","50","51","52","53","54","61","62","63","64","65","71","81","82","91"].includes(t.substr(0,2))&&(()=>{if(18===t.length){const e=t.split(""),n=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2],r=[1,0,"X",9,8,7,6,5,4,3,2];let s=0,o=0,i=0;for(let t=0;t<17;t++)o=parseInt(e[t]),i=n[t],s+=o*i;return r[s%11].toString()===e[17]}return!0})()},e.NOMETHOD=j,e.array2tree=function(e,t={}){const{primaryKey:n,parentKey:r,childrenKey:i,createRoot:a,parentRefKey:d}={primaryKey:"id",parentKey:"pid",childrenKey:"children",createRoot:!1,parentRefKey:!1,...t},u=d&&("string"==typeof d?d:"_parent"),f={},p=[];if(o(e)){const t=[],s=e=>{e.forEach((e=>{c(f,e[n])||(f[e[n]]={...e,...l(i)}),e[r]?c(f,e[r])?f[e[r]][i].push(Object.assign(f[e[n]],u?{[u]:f[e[r]]}:{})):t.push(e):p.push(f[e[n]])}))};s(e),console.log(1111,t),t.length&&s(t)}return s(a)?a(p):a?{[i]:p}:p},e.awaitWrapper=f,e.b64UriDecode=e=>decodeURIComponent(window.atob(e)),e.b64UriEncode=e=>window.btoa(encodeURIComponent(e)),e.byteStringify=function(e,t){const n=Object.assign({standard:"jedec",unitLvl:"auto",precision:1,detail:!1},t),{standard:r,unitLvl:s,precision:i,detail:a}=n;let c=parseFloat(e);if(!Number.isFinite(c))return;const l=c<0?-1:1;c=Math.abs(c);const{base:d,unitMap:u}=((e,t)=>{const n={B:{expMax:0,units:{metric:"B",iec:"B",jedec:"B"}},K:{expMax:1,units:{metric:"kB",iec:"KiB",jedec:"KB"}},M:{expMax:2,units:{metric:"MB",iec:"MiB",jedec:"MB"}},G:{expMax:3,units:{metric:"GB",iec:"GiB",jedec:"GB"}},T:{expMax:4,units:{metric:"TB",iec:"TiB",jedec:"TB"}},P:{expMax:5,units:{metric:"PB",iec:"PiB",jedec:"PB"}},E:{expMax:6,units:{metric:"EB",iec:"EiB",jedec:"EB"}},Z:{expMax:7,units:{metric:"ZB",iec:"ZiB",jedec:"ZB"}},Y:{expMax:8,units:{metric:"YB",iec:"YiB",jedec:"YB"}}},r={metric:1e3,iec:1024,jedec:1024};return{base:r[e]||r.jedec,unitMap:n[t]||Object.values(n)}})(r,s),f=e=>Number.isInteger(e)?e:e.toFixed(i);let p="",m=0;if(o(u))u.some((e=>{const t=Math.pow(d,e.expMax),n=c/t;return!(n>d)&&(p=e.units[r],m=f(n*l),!0)}));else{const e=Math.pow(d,u.expMax);p=u.units[r];m=f(c/e*l)}return a?{value:m,unit:p}:`${m} ${p}`},e.checkoutBy=function(e,t,n){return a(e)?o(t)?t.map((t=>e[t])):t&&a(t)?Object.keys(t).map((r=>{const s=t[r];return a(e[r])&&a(s)?n?n({},e[r],s):Object.assign({},e[r],s):s||e[r]})):Object.values(e):[]},e.createRAFTimer=e=>{const{autoStopWhenNoTask:t,autoStartWhenAddTask:n}={...e};let r=0,s=!0,o=0,i=0,a=[],c=!1;const l=e=>{const n=e-(i||e);i=e,o+=n,c&&(a=a.filter((e=>!e.needClear)),c=!1),!t||a.length?(a.forEach((e=>{const{callback:t,maxTime:r,runTime:s,elapsed:i,interval:a,needClear:l}=e;if(!l){if(r&&s>=r)return e.needClear=!0,void(c=!0);if(i>=a){try{t(o)}catch(e){}e.elapsed=0,e.runTime+=1}else e.elapsed+=n}})),r=window.requestAnimationFrame(l)):s=!0},d=()=>{r=window.requestAnimationFrame(l),s=!1},u=()=>{window.cancelAnimationFrame(r),s=!0};return{start:d,stop:u,pauseToggle:()=>{s?d():u()},addTask:(e,t,r)=>{e&&(n&&s&&d(),a.push({callback:e,elapsed:0,interval:t,maxTime:r,runTime:0}))},removeTask:e=>{a=a.filter((t=>t.callback!==e))},isPaused:()=>s}},e.eventTargetEmitter=x,e.filterNullable=y,e.formParamsSwitch=b,e.formParamsSwitchCreator=e=>(t,n,r)=>b(t,n,{dateFormat:e,...r}),e.formulaValidate=function(e,t){return e=e.replace(/\s/g,""),!/[+\-*/]{2,}/.test(e)&&!/\(\)/.test(e)&&!/\([+\-*/]/.test(e)&&!/[+\-*/]\)/.test(e)&&!/[^+\-*/]\(/.test(e)&&!/\)[^+\-*/]/.test(e)&&(()=>{const t=[];for(let n,r=0;r<e.length;r++)if(n=e.charAt(r),"("===n)t.push("(");else if(")"===n){if(!(t.length>0))return!1;t.pop()}return!t.length})()&&(!o(t)||(n=t,e.replace(/[()+\-*/]{1,}/g,"`").split("`").every((e=>!/[A-Z]/i.test(e)||n.includes(e)))));var n},e.isNullable=h,e.mapToObject=function(e,t="key",n="value"){const r={};return o(e)&&t&&n&&[t,n].every((e=>["string","function"].includes(typeof e)))&&e.forEach(((e,s)=>{const o="string"==typeof t?e[t]:t(e,s),i="string"==typeof n?e[n]:n(e,s);["string","number"].includes(typeof o)&&(r[o]=i)})),r},e.maskData=function(e,t){if("string"!=typeof e||!e)return"";const n=t&&t.mode&&u[t.mode]?u[t.mode]:{},{maskWith:r,startCharIndex:s=0,endCharIndex:o,startFrom:i,endUntil:a}={maskWith:"*",...n,...t};let c=e,l="",d="";const f=i?e.indexOf(i):-1;if(f>-1){const t=f+i.length;c=c.slice(t),l=e.slice(0,t)}const p=a?e.lastIndexOf(a):-1;p>-1&&(c=c.slice(0,p),d=e.slice(p));const m=c.split(""),h=[l],y=m.length,g=[s>=0?s:y+s,void 0!==o?o>=0?o:y+o:y-1];let[b,M]=g;return M=M>0&&M<y?M:y-1,b=b>=0&&b<=M?b:0,m.forEach(((e,t)=>{h.push(t>=b&&t<=M?r:e)})),h.push(d),h.join("")},e.pageCommunicate=function(e){const{messageHanlder:t,currentPage:n}=e||{},{emit:r,on:s,off:o,createPayload:i,removeAllListeners:a}=x({name:n,customHanlderCreator:t}),c=e=>r(e.data);let l;const d=window.localStorage,u="PAGE_COMMUNICATE_CHANNEL";if(void 0!==typeof window.BroadcastChannel)l=new BroadcastChannel(u),l.addEventListener("message",c);else{const e=()=>{const e=m(d.getItem(u)||"");e&&r(e)};window.addEventListener("storage",e)}return{on:s,off:o,send:(...e)=>{const t=i(...e);if(l)l.postMessage(t);else{const e=JSON.stringify({...t,ts:+new Date});d.setItem(u,e)}},destory:()=>{a(),l?l.close():d.removeItem(u)}}},e.pickRenameKeys=function(e,t){if(!(e&&a(e)&&t&&a(t)))return;const n={};for(const r in e)r in t&&(n[t[r]]=e[r]);return n},e.safeJsonParse=m,e.secondsToDuration=(e,t="h")=>{const n=Number.isInteger(e)?e:Math.round(e),r={s:n%60};switch(t){case"m":r.m=Math.floor(n/60);break;case"h":r.m=Math.floor(n%3600/60),r.h=Math.floor(n/3600);break;case"d":r.m=Math.floor(n%3600/60),r.h=Math.floor(n%86400/3600),r.d=Math.floor(n/3600/24)}return r},e.switchNullToUndefined=g,e.tree2array=function(e,t={}){const{primaryKey:n,parentKey:r,childrenKey:s,hasParentKey:i,returnObject:a}=Object.assign({hasParentKey:!0,primaryKey:"id",parentKey:"pid",childrenKey:"children",returnObject:!1},t),c=a?{}:[];return o(e)||"object"==typeof e?(function e(t,l,d=!1){const u=i?{}:{[r]:l};if(!d){const e=Object.assign(u,function(e,t){const n={};for(const r in e)r!==t&&(n[r]=e[r]);return n}(t,s));a?c[t[n]]=e:c.push(e)}o(t[s])&&t[s].length&&t[s].forEach((r=>e(r,t[n])))}(o(e)?l(s,e):e,null,!0),c):c},e.treeAnalyse=function(e,t,n){const r={nodes:[],childKeysMaps:{},keyNodeMap:{},disabledKeys:[]},s=Array.isArray(n)?n:["nodes","keyNodeMap","childKeysMaps","disabledKeys"],{primaryKey:o,labelKey:i,disabledKey:a,childrenKey:c}={primaryKey:"id",labelKey:"name",childrenKey:"children",disabledKey:"disabled",...t},[l,d,u,f]=Object.keys(r).map((e=>s.includes(e))),p=(e,t)=>{e.forEach((e=>{const{[o]:n,[i]:s,[c]:m,[a]:h}=e;let y;l&&r.nodes.push(e),u&&void 0!==n&&(y={keyVlaue:n,keyLabel:s,parent:t,children:[]},t?.children.push(y),r.keyNodeMap[n]=y),f&&h&&void 0!==n&&r.disabledKeys.push(n),Array.isArray(m)&&m.length&&(d&&(r.childKeysMaps[n]=m.map((e=>e[o]))),p(m,y))}))};return e&&p(e),r},e.wp=p,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -10,7 +10,7 @@ interface PropHandler {
10
10
  (item: any, index: number): string;
11
11
  }
12
12
  export declare function mapToObject(objectArray: AnyObject[], keyProp?: string | PropHandler, valueProp?: string | PropHandler): Record<string, string | number>;
13
- declare type MergeFn = <T>(...args: T[]) => T;
13
+ type MergeFn = <T>(...args: T[]) => T;
14
14
  /**
15
15
  * checkout values form object as an array
16
16
  * 从对象中挑选指定的值并以数组形式返回,必要时可使用自定义属性覆盖选中对象
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -1,4 +1,4 @@
1
- declare type AnyObject = Record<string | number, any>;
1
+ type AnyObject = Record<string | number, any>;
2
2
  /**
3
3
  * JSON.parse string safely
4
4
  * @param json string
@@ -28,8 +28,8 @@ export declare const switchNullToUndefined: (data: any) => any;
28
28
  * 参数转换规则的配置对象
29
29
  * 值可以是时间范围转换所需的开始,结束时间字段的名称,或者需要进行拼接的数组
30
30
  */
31
- export declare type ParamsSwitchMaps<DK extends string = string, RK extends string = string> = Record<DK, [RK, RK] | [RK, RK, string] | 'join' | 'pop'>;
32
- export declare type DateFormat = (date: any, format?: string) => string;
31
+ export type ParamsSwitchMaps<DK extends string = string, RK extends string = string> = Record<DK, [RK, RK] | [RK, RK, string] | 'join' | 'pop'>;
32
+ export type DateFormat = (date: any, format?: string) => string;
33
33
  /**
34
34
  * 将搜素条件里的数组字段转换为其他格式,通常用于搜索表单的字段转换
35
35
  * @param formData 传入参数
package/dist/optional.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -23,5 +23,5 @@ export declare function pageCommunicate(options?: PcConfigOptions): {
23
23
  send: (methodOrPayload: string | OrgEventPayload<any>, data?: any, target?: string | undefined) => void;
24
24
  destory: () => void;
25
25
  };
26
- export declare type BccnInstance = ReturnType<typeof pageCommunicate>;
26
+ export type BccnInstance = ReturnType<typeof pageCommunicate>;
27
27
  export default pageCommunicate;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
package/dist/promise.d.ts CHANGED
@@ -4,13 +4,13 @@
4
4
  * @returns Promise<[K, undefined] | [null, T]>
5
5
  */
6
6
  export declare function awaitWrapper<T, K = Error>(promise: Promise<T>): Promise<[null, T] | [K, undefined]>;
7
- export declare type BoolRef = {
7
+ export type BoolRef = {
8
8
  [key: string]: boolean;
9
9
  };
10
10
  /** 防止多次promise函数运行控制器,对于响应式系统,可以同时用作BoolSwitch */
11
- export declare type LockRefHandle<T = BoolRef> = [T, keyof T];
11
+ export type LockRefHandle<T = BoolRef> = [T, keyof T];
12
12
  /** loading等状态的切换函数 */
13
- export declare type BoolSwitch = (val: boolean) => unknown;
13
+ export type BoolSwitch = (val: boolean) => unknown;
14
14
  /**
15
15
  * wrap promise with lock, support reactive environment like react or vue
16
16
  * @param promise promise
@@ -24,10 +24,10 @@ export interface WpOptions<R = BoolRef> {
24
24
  /** when you need function and syncRefHandle at sametime, in react hooks */
25
25
  syncRefHandle?: LockRefHandle<R>;
26
26
  }
27
- declare type WpReturn<T> = Promise<T | undefined>;
28
- declare type WpArrReturn<T> = Promise<[null, T] | [Error, undefined]>;
29
- declare type WpMayLockArrReturn<T> = Promise<[null, T] | [Error, undefined]>;
30
- declare type WpPromise<T> = Promise<T> | (() => Promise<T>);
27
+ type WpReturn<T> = Promise<T | undefined>;
28
+ type WpArrReturn<T> = Promise<[null, T] | [Error, undefined]>;
29
+ type WpMayLockArrReturn<T> = Promise<[null, T] | [Error, undefined]>;
30
+ type WpPromise<T> = Promise<T> | (() => Promise<T>);
31
31
  declare function wrapPromise<T, R = BoolRef>(promise: WpPromise<T>, options?: WpOptions<R> & {
32
32
  wrap?: false;
33
33
  }): WpReturn<T>;
package/dist/promise.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -12,7 +12,7 @@ interface TaskItem {
12
12
  /** 当前任务是否需要在下个循环周期时清除,内部变量 */
13
13
  needClear?: boolean;
14
14
  }
15
- export declare type TimerCallback = TaskItem['callback'];
15
+ export type TimerCallback = TaskItem['callback'];
16
16
  export interface RAFTimerOptions {
17
17
  /** 无任务时是否自动停止,停止后需要手动启动 */
18
18
  autoStopWhenNoTask?: boolean;
@@ -32,5 +32,5 @@ export declare const createRAFTimer: (options?: RAFTimerOptions) => {
32
32
  isPaused: () => boolean;
33
33
  };
34
34
  /** 计时器实例 */
35
- export declare type TimerInstance = ReturnType<typeof createRAFTimer>;
35
+ export type TimerInstance = ReturnType<typeof createRAFTimer>;
36
36
  export {};
package/dist/raf-timer.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare type AnyObject = {
1
+ export type AnyObject = {
2
2
  [key: string]: any;
3
3
  };
4
- export declare type AnyFunction<T = any> = (...args: any[]) => T;
5
- export declare type StrOrNum = string | number;
4
+ export type AnyFunction<T = any> = (...args: any[]) => T;
5
+ export type StrOrNum = string | number;
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
package/dist/validate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -4,7 +4,7 @@ interface Options {
4
4
  precision?: number;
5
5
  detail?: boolean;
6
6
  }
7
- declare type StrOrNum = number | string;
7
+ type StrOrNum = number | string;
8
8
  export declare function byteStringify(byteNum: StrOrNum, options?: Options & {
9
9
  detail?: false;
10
10
  }): string;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @wxhccc/es-util v2.1.0
3
- * (c) 2022 wxhccc
2
+ * @wxhccc/es-util v2.1.1
3
+ * (c) 2023 wxhccc
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxhccc/es-util",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A library that contains some useful methods",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",