@vtj/utils 0.6.10 → 0.6.12

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 d0 = "0.6.10";
1
+ const d0 = "0.6.12";
2
2
  var Ds = typeof global == "object" && global && global.Object === Object && global;
3
3
  const qn = Ds;
4
4
  var $s = typeof self == "object" && self && self.Object === Object && self, Bs = qn || $s || Function("return this")();
@@ -1616,6 +1616,18 @@ function N0(e, t) {
1616
1616
  } else
1617
1617
  return Array.from(new Set(e));
1618
1618
  }
1619
+ function I0(e) {
1620
+ return e ? [].concat(e) : [];
1621
+ }
1622
+ function M0(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 Qi(e, t) {
1620
1632
  return function() {
1621
1633
  return e.apply(t, arguments);
@@ -3238,13 +3250,13 @@ function hp(e) {
3238
3250
  data: r
3239
3251
  });
3240
3252
  }
3241
- function I0(e) {
3253
+ function F0(e) {
3242
3254
  const t = {};
3243
3255
  for (const [r, n] of Object.entries(e))
3244
3256
  t[r] = hp(n);
3245
3257
  return t;
3246
3258
  }
3247
- const M0 = (e) => Qt ? window.requestAnimationFrame(e) : setTimeout(e, 16), F0 = (e) => Qt ? window.cancelAnimationFrame(e) : clearTimeout(e);
3259
+ const j0 = (e) => Qt ? window.requestAnimationFrame(e) : setTimeout(e, 16), L0 = (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 $r(e) {
3250
3262
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -3580,7 +3592,7 @@ var pp = { exports: {} };
3580
3592
  });
3581
3593
  })(pp);
3582
3594
  Ss.locale("zh-cn");
3583
- function j0(e, t = "YYYY-MM-DD HH:mm:ss") {
3595
+ function U0(e, t = "YYYY-MM-DD HH:mm:ss") {
3584
3596
  return Ss(e).format(t);
3585
3597
  }
3586
3598
  var Ts = { exports: {} };
@@ -4003,7 +4015,7 @@ var Ts = { exports: {} };
4003
4015
  })(Ts);
4004
4016
  var gp = Ts.exports;
4005
4017
  const mp = /* @__PURE__ */ $r(gp);
4006
- function L0(e, t) {
4018
+ function H0(e, t) {
4007
4019
  return mp(e).format(t);
4008
4020
  }
4009
4021
  class yp {
@@ -4055,20 +4067,20 @@ class yp {
4055
4067
  n === this.caches ? this.caches = {} : n.clear();
4056
4068
  }
4057
4069
  }
4058
- const U0 = new yp(), vp = /^(http|https):\/\/[\w.:\-@]*/, bp = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, wp = /^(^[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])$)$/, Sp = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, Tp = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/, xp = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
4059
- function H0(e) {
4070
+ const V0 = new yp(), vp = /^(http|https):\/\/[\w.:\-@]*/, bp = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, wp = /^(^[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])$)$/, Sp = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, Tp = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/, xp = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
4071
+ function q0(e) {
4060
4072
  return vp.test(e);
4061
4073
  }
4062
- function V0(e) {
4074
+ function z0(e) {
4063
4075
  return bp.test(e);
4064
4076
  }
4065
- function q0(e) {
4077
+ function k0(e) {
4066
4078
  return wp.test(e);
4067
4079
  }
4068
- function z0(e) {
4080
+ function K0(e) {
4069
4081
  return Sp.test(e);
4070
4082
  }
4071
- function k0(e) {
4083
+ function W0(e) {
4072
4084
  return xp.test(e) || Tp.test(e);
4073
4085
  }
4074
4086
  /*! js-cookie v3.0.5 | MIT */
@@ -4151,7 +4163,7 @@ function Op(e) {
4151
4163
  function Ap(e, t) {
4152
4164
  Br.remove(e, t);
4153
4165
  }
4154
- const K0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4166
+ const G0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4155
4167
  __proto__: null,
4156
4168
  get: Op,
4157
4169
  remove: Ap,
@@ -6701,7 +6713,7 @@ function o0(e, t) {
6701
6713
  const r = new i0();
6702
6714
  return r.setKey(e), r.encrypt(t);
6703
6715
  }
6704
- const W0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6716
+ const Y0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6705
6717
  __proto__: null,
6706
6718
  RSA: o0,
6707
6719
  md5: s0
@@ -6743,7 +6755,7 @@ function Rs(e, t) {
6743
6755
  const r = e.split("?")[0], n = hr(e), i = Object.assign({}, n, t), s = As(i);
6744
6756
  return s ? [r, s].join("?") : e;
6745
6757
  }
6746
- const G0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6758
+ const J0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6747
6759
  __proto__: null,
6748
6760
  UrlRegex: Pr,
6749
6761
  append: Rs,
@@ -6764,7 +6776,7 @@ const h0 = {
6764
6776
  name: "",
6765
6777
  script: !1
6766
6778
  };
6767
- function Y0(e, t = {}, r) {
6779
+ function Z0(e, t = {}, r) {
6768
6780
  const n = Object.assign({}, h0, r || {}), i = n.name || `${n.prefix}${++c0}`, s = document.getElementsByTagName("script")[0] || document.head;
6769
6781
  let o, a;
6770
6782
  return new Promise((c, u) => {
@@ -6803,57 +6815,59 @@ export {
6803
6815
  yp as Storage,
6804
6816
  vp as URL_REGEX,
6805
6817
  qh as arrayToMap,
6806
- F0 as cAF,
6818
+ L0 as cAF,
6807
6819
  qf as camelCase,
6820
+ M0 as cleanObject,
6808
6821
  g0 as cloneDeep,
6809
- K0 as cookie,
6822
+ G0 as cookie,
6810
6823
  hp as createApi,
6811
- I0 as createApis,
6824
+ F0 as createApis,
6812
6825
  cp as createRequest,
6813
- W0 as crypto,
6814
- j0 as dateFormat,
6826
+ Y0 as crypto,
6827
+ U0 as dateFormat,
6815
6828
  Ss as dayjs,
6816
6829
  Wi as debounce,
6817
6830
  N0 as dedupArray,
6818
6831
  C0 as delay,
6819
6832
  p0 as get,
6820
- k0 as isCarNo,
6833
+ W0 as isCarNo,
6821
6834
  Qt as isClient,
6822
6835
  w0 as isDef,
6823
- V0 as isEmail,
6836
+ z0 as isEmail,
6824
6837
  m0 as isEqual,
6825
6838
  _0 as isFunction,
6826
- q0 as isIdNumber,
6827
- z0 as isMobilePhone,
6839
+ k0 as isIdNumber,
6840
+ K0 as isMobilePhone,
6828
6841
  O0 as isObject,
6829
6842
  fi as isPlainObject,
6830
6843
  A0 as isString,
6831
6844
  R0 as isUndefined,
6832
- H0 as isUrl,
6833
- Y0 as jsonp,
6845
+ q0 as isUrl,
6846
+ Z0 as jsonp,
6834
6847
  y0 as kebabCase,
6835
6848
  v0 as lowerFirst,
6836
6849
  P0 as mapToObject,
6837
6850
  se as merge,
6838
6851
  S0 as now,
6839
- L0 as numberFormat,
6852
+ H0 as numberFormat,
6840
6853
  mp as numeral,
6841
6854
  Le as omit,
6842
6855
  $0 as pick,
6843
- M0 as rAF,
6856
+ j0 as rAF,
6844
6857
  x0 as rand,
6845
6858
  lp as request,
6846
6859
  b0 as set,
6847
- U0 as storage,
6860
+ V0 as storage,
6848
6861
  Xi as template,
6849
6862
  Hh as throttle,
6850
6863
  T0 as timestamp,
6864
+ I0 as toArray,
6851
6865
  B0 as toFixed,
6852
6866
  vn as trim,
6853
6867
  Vh as uid,
6854
6868
  bi as upperFirst,
6855
6869
  D0 as upperFirstCamelCase,
6856
- G0 as url,
6870
+ J0 as url,
6857
6871
  E0 as uuid,
6858
6872
  d0 as version
6859
6873
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/utils",
3
3
  "private": false,
4
- "version": "0.6.10",
4
+ "version": "0.6.12",
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.10",
17
+ "@vtj/cli": "^0.6.12",
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": "65d67f3b63e6f93ec0059705d151a23bb572827e",
42
+ "gitHead": "32f2999b1ae3f89a4cafea105abc89888aaa5b4c",
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.10";
1
+ export declare const version = "0.6.12";