@vtj/utils 0.6.11 → 0.6.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/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const g0 = "0.6.11";
1
+ const g0 = "0.6.13";
2
2
  var $s = typeof global == "object" && global && global.Object === Object && global;
3
3
  const kn = $s;
4
4
  var Bs = typeof self == "object" && self && self.Object === Object && self, Cs = kn || Bs || Function("return this")();
@@ -1616,6 +1616,18 @@ function M0(e, t) {
1616
1616
  } else
1617
1617
  return Array.from(new Set(e));
1618
1618
  }
1619
+ function F0(e) {
1620
+ return e ? [].concat(e) : [];
1621
+ }
1622
+ function j0(e) {
1623
+ return Object.keys(e).reduce(
1624
+ (t, r) => {
1625
+ const n = e[r];
1626
+ return n != null && (t[r] = n), t;
1627
+ },
1628
+ {}
1629
+ );
1630
+ }
1619
1631
  function es(e, t) {
1620
1632
  return function() {
1621
1633
  return e.apply(t, arguments);
@@ -3238,13 +3250,13 @@ function dp(e) {
3238
3250
  data: r
3239
3251
  });
3240
3252
  }
3241
- function F0(e) {
3253
+ function L0(e) {
3242
3254
  const t = {};
3243
3255
  for (const [r, n] of Object.entries(e))
3244
3256
  t[r] = dp(n);
3245
3257
  return t;
3246
3258
  }
3247
- const j0 = (e) => Qt ? window.requestAnimationFrame(e) : setTimeout(e, 16), L0 = (e) => Qt ? window.cancelAnimationFrame(e) : clearTimeout(e);
3259
+ const U0 = (e) => Qt ? window.requestAnimationFrame(e) : setTimeout(e, 16), H0 = (e) => Qt ? window.cancelAnimationFrame(e) : clearTimeout(e);
3248
3260
  var vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3249
3261
  function Br(e) {
3250
3262
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -3582,7 +3594,7 @@ var mp = { exports: {} };
3582
3594
  });
3583
3595
  })(mp);
3584
3596
  Ts.locale("zh-cn");
3585
- function U0(e, t = "YYYY-MM-DD HH:mm:ss") {
3597
+ function V0(e, t = "YYYY-MM-DD HH:mm:ss") {
3586
3598
  return Ts(e).format(t);
3587
3599
  }
3588
3600
  var xs = { exports: {} };
@@ -4005,7 +4017,7 @@ var xs = { exports: {} };
4005
4017
  })(xs);
4006
4018
  var yp = xs.exports;
4007
4019
  const vp = /* @__PURE__ */ Br(yp);
4008
- function H0(e, t) {
4020
+ function q0(e, t) {
4009
4021
  return vp(e).format(t);
4010
4022
  }
4011
4023
  class bp {
@@ -4057,20 +4069,20 @@ class bp {
4057
4069
  n === this.caches ? this.caches = {} : n.clear();
4058
4070
  }
4059
4071
  }
4060
- const V0 = new bp(), wp = /^(http|https):\/\/[\w.:\-@]*/, Sp = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, Tp = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/, xp = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, Ep = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/, _p = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
4061
- function q0(e) {
4072
+ const z0 = new bp(), wp = /^(http|https):\/\/[\w.:\-@]*/, Sp = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, Tp = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/, xp = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, Ep = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/, _p = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
4073
+ function k0(e) {
4062
4074
  return wp.test(e);
4063
4075
  }
4064
- function z0(e) {
4076
+ function K0(e) {
4065
4077
  return Sp.test(e);
4066
4078
  }
4067
- function k0(e) {
4079
+ function W0(e) {
4068
4080
  return Tp.test(e);
4069
4081
  }
4070
- function K0(e) {
4082
+ function G0(e) {
4071
4083
  return xp.test(e);
4072
4084
  }
4073
- function W0(e) {
4085
+ function Y0(e) {
4074
4086
  return _p.test(e) || Ep.test(e);
4075
4087
  }
4076
4088
  /*! js-cookie v3.0.5 | MIT */
@@ -4153,7 +4165,7 @@ function Rp(e) {
4153
4165
  function Dp(e, t) {
4154
4166
  Cr.remove(e, t);
4155
4167
  }
4156
- const G0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4168
+ const J0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4157
4169
  __proto__: null,
4158
4170
  get: Rp,
4159
4171
  remove: Dp,
@@ -6703,7 +6715,7 @@ function u0(e, t) {
6703
6715
  const r = new o0();
6704
6716
  return r.setKey(e), r.encrypt(t);
6705
6717
  }
6706
- const Y0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6718
+ const Z0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6707
6719
  __proto__: null,
6708
6720
  RSA: u0,
6709
6721
  md5: a0
@@ -6745,7 +6757,7 @@ function Ds(e, t) {
6745
6757
  const r = e.split("?")[0], n = dr(e), i = Object.assign({}, n, t), s = Rs(i);
6746
6758
  return s ? [r, s].join("?") : e;
6747
6759
  }
6748
- const J0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6760
+ const X0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6749
6761
  __proto__: null,
6750
6762
  UrlRegex: Nr,
6751
6763
  append: Ds,
@@ -6766,7 +6778,7 @@ const p0 = {
6766
6778
  name: "",
6767
6779
  script: !1
6768
6780
  };
6769
- function Z0(e, t = {}, r) {
6781
+ function Q0(e, t = {}, r) {
6770
6782
  const n = Object.assign({}, p0, r || {}), i = n.name || `${n.prefix}${++h0}`, s = document.getElementsByTagName("script")[0] || document.head;
6771
6783
  let o, a;
6772
6784
  return new Promise((c, u) => {
@@ -6805,57 +6817,59 @@ export {
6805
6817
  bp as Storage,
6806
6818
  wp as URL_REGEX,
6807
6819
  zh as arrayToMap,
6808
- L0 as cAF,
6820
+ H0 as cAF,
6809
6821
  zf as camelCase,
6822
+ j0 as cleanObject,
6810
6823
  y0 as cloneDeep,
6811
- G0 as cookie,
6824
+ J0 as cookie,
6812
6825
  dp as createApi,
6813
- F0 as createApis,
6826
+ L0 as createApis,
6814
6827
  lp as createRequest,
6815
- Y0 as crypto,
6816
- U0 as dateFormat,
6828
+ Z0 as crypto,
6829
+ V0 as dateFormat,
6817
6830
  Ts as dayjs,
6818
6831
  Yi as debounce,
6819
6832
  M0 as dedupArray,
6820
6833
  N0 as delay,
6821
6834
  m0 as get,
6822
- W0 as isCarNo,
6835
+ Y0 as isCarNo,
6823
6836
  Qt as isClient,
6824
6837
  T0 as isDef,
6825
- z0 as isEmail,
6838
+ K0 as isEmail,
6826
6839
  v0 as isEqual,
6827
6840
  A0 as isFunction,
6828
- k0 as isIdNumber,
6829
- K0 as isMobilePhone,
6841
+ W0 as isIdNumber,
6842
+ G0 as isMobilePhone,
6830
6843
  R0 as isObject,
6831
6844
  li as isPlainObject,
6832
6845
  D0 as isString,
6833
6846
  $0 as isUndefined,
6834
- q0 as isUrl,
6835
- Z0 as jsonp,
6847
+ k0 as isUrl,
6848
+ Q0 as jsonp,
6836
6849
  b0 as kebabCase,
6837
6850
  w0 as lowerFirst,
6838
6851
  I0 as mapToObject,
6839
6852
  se as merge,
6840
6853
  x0 as now,
6841
- H0 as numberFormat,
6854
+ q0 as numberFormat,
6842
6855
  vp as numeral,
6843
6856
  Le as omit,
6844
6857
  C0 as pick,
6845
- j0 as rAF,
6858
+ U0 as rAF,
6846
6859
  _0 as rand,
6847
6860
  hp as request,
6848
6861
  S0 as set,
6849
- V0 as storage,
6862
+ z0 as storage,
6850
6863
  ts as template,
6851
6864
  Vh as throttle,
6852
6865
  E0 as timestamp,
6866
+ F0 as toArray,
6853
6867
  P0 as toFixed,
6854
6868
  bn as trim,
6855
6869
  qh as uid,
6856
6870
  Si as upperFirst,
6857
6871
  B0 as upperFirstCamelCase,
6858
- J0 as url,
6872
+ X0 as url,
6859
6873
  O0 as uuid,
6860
6874
  g0 as version
6861
6875
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/utils",
3
3
  "private": false,
4
- "version": "0.6.11",
4
+ "version": "0.6.13",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "@types/js-cookie": "~3.0.4",
15
15
  "@types/lodash-es": "~4.17.8",
16
16
  "@types/numeral": "~2.0.3",
17
- "@vtj/cli": "^0.6.11",
17
+ "@vtj/cli": "^0.6.13",
18
18
  "@vueuse/core": "~10.4.1",
19
19
  "axios": "~1.5.1",
20
20
  "crypto-js": "~4.1.1",
@@ -39,7 +39,7 @@
39
39
  "require": "./lib/index.cjs"
40
40
  }
41
41
  },
42
- "gitHead": "bbc8d775e492fc55d6450a4b6293d0692fedfdb0",
42
+ "gitHead": "a6c774eac713a1c43b0dda49c2279d5093718128",
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  }
package/types/util.d.ts CHANGED
@@ -63,3 +63,5 @@ export declare function delay(val?: number): Promise<unknown>;
63
63
  export declare function arrayToMap<T>(data: T[], prop: keyof T): Map<any, T>;
64
64
  export declare function mapToObject<V = any>(map: Map<any, V>): Record<any, V>;
65
65
  export declare function dedupArray<T>(array: any[], prop?: keyof T): any[];
66
+ export declare function toArray<T = any>(maybeArray?: T | T[]): T[];
67
+ export declare function cleanObject(obj: Record<string, any>): Record<string, any>;
@@ -1 +1 @@
1
- export declare const version = "0.6.11";
1
+ export declare const version = "0.6.13";