@spacego/turbo-utils 1.0.3 → 1.0.4

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/cjs/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./calc/index.cjs");const a=require("./day/dayjs.cjs"),e=require("./is/is.cjs"),l=require("./is/is-empty.cjs"),t=require("./is/is-equals.cjs"),u=require("./utils/classnames.cjs"),c=require("./utils/deep-clone.cjs"),d=require("./utils/pick.cjs"),r=require("./utils/query2params.cjs"),s=require("./utils/util.cjs"),n=require("./utils/uuid.cjs"),o=require("./validator/validate.cjs"),i=require("./validator/validator.cjs"),m=require("./calc/calc.cjs"),p=require("./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.cjs");exports.WEEK_DAY=a.WEEK_DAY;exports.formatActivityTime=a.formatActivityTime;exports.formatDate=a.formatDate;exports.formatIosDate=a.formatIosDate;exports.getDateDiff=a.getDateDiff;exports.getDateParams=a.getDateParams;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isDate=e.isDate;exports.isFile=e.isFile;exports.isFunction=e.isFunction;exports.isMap=e.isMap;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isSet=e.isSet;exports.isString=e.isString;exports.isUndefined=e.isUndefined;exports.isEmpty=l.isEmpty;exports.depsAreSame=t.depsAreSame;exports.isEquals=t.isEquals;exports.classnames=u.classnames;exports.deepClone=c.deepClone;exports.pick=d.pick;exports.filterParams=r.filterParams;exports.filterQuery=r.filterQuery;exports.filtrationEmpty=r.filtrationEmpty;exports.getUrlParam=r.getUrlParam;exports.json2params=r.json2params;exports.padQuery=r.padQuery;exports.params2json=r.params2json;exports.ObjectAssign=s.ObjectAssign;exports.browser=s.browser;exports.calculateDistance=s.calculateDistance;exports.dictEscape=s.dictEscape;exports.encryptString=s.encryptString;exports.isBrowser=s.isBrowser;exports.padZero=s.padZero;exports.thousands=s.thousands;exports.underlineToHump=s.underlineToHump;exports.randomString=n.randomString;exports.uuid=n.uuid;exports.validate=o.validate;exports.validateRequire=o.validateRequire;exports.isCard=i.isCard;exports.isCurrency=i.isCurrency;exports.isEmail=i.isEmail;exports.isIdCard=i.isIdCard;exports.isMobile=i.isMobile;exports.isPassport=i.isPassport;exports.isUrl=i.isUrl;exports.maxLength=i.maxLength;exports.minLength=i.minLength;exports.regs=i.regs;exports.required=i.required;exports.validateType=i.validateType;exports.validation=i.validation;exports.calc=m.default;exports.Decimal=p.Decimal;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./calc/index.cjs");const m=require("dayjs"),a=require("./day/dayjs.cjs"),e=require("./is/is.cjs"),p=require("./is/is-empty.cjs"),c=require("./is/is-equals.cjs"),f=require("./utils/classnames.cjs"),g=require("./utils/deep-clone.cjs"),y=require("./utils/pick.cjs"),s=require("./utils/query2params.cjs"),r=require("./utils/util.cjs"),u=require("./utils/uuid.cjs"),d=require("./validator/validate.cjs"),i=require("./validator/validator.cjs"),q=require("./calc/calc.cjs"),D=require("./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.cjs");function b(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return o.default=t,Object.freeze(o)}const E=b(m);exports.dayjs=E;exports.WEEK_DAY=a.WEEK_DAY;exports.formatActivityTime=a.formatActivityTime;exports.formatDate=a.formatDate;exports.formatIosDate=a.formatIosDate;exports.getDateDiff=a.getDateDiff;exports.getDateParams=a.getDateParams;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isDate=e.isDate;exports.isFile=e.isFile;exports.isFunction=e.isFunction;exports.isMap=e.isMap;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isSet=e.isSet;exports.isString=e.isString;exports.isUndefined=e.isUndefined;exports.isEmpty=p.isEmpty;exports.depsAreSame=c.depsAreSame;exports.isEquals=c.isEquals;exports.classnames=f.classnames;exports.deepClone=g.deepClone;exports.pick=y.pick;exports.filterParams=s.filterParams;exports.filterQuery=s.filterQuery;exports.filtrationEmpty=s.filtrationEmpty;exports.getUrlParam=s.getUrlParam;exports.json2params=s.json2params;exports.padQuery=s.padQuery;exports.params2json=s.params2json;exports.ObjectAssign=r.ObjectAssign;exports.browser=r.browser;exports.calculateDistance=r.calculateDistance;exports.dictEscape=r.dictEscape;exports.encryptString=r.encryptString;exports.isBrowser=r.isBrowser;exports.padZero=r.padZero;exports.thousands=r.thousands;exports.underlineToHump=r.underlineToHump;exports.randomString=u.randomString;exports.uuid=u.uuid;exports.validate=d.validate;exports.validateRequire=d.validateRequire;exports.isCard=i.isCard;exports.isCurrency=i.isCurrency;exports.isEmail=i.isEmail;exports.isIdCard=i.isIdCard;exports.isMobile=i.isMobile;exports.isPassport=i.isPassport;exports.isUrl=i.isUrl;exports.maxLength=i.maxLength;exports.minLength=i.minLength;exports.regs=i.regs;exports.required=i.required;exports.validateType=i.validateType;exports.validation=i.validation;exports.calc=q.default;exports.Decimal=D.Decimal;
@@ -24,7 +24,7 @@ function h(o, e) {
24
24
  // 季度
25
25
  S: t.millisecond()
26
26
  // 毫秒
27
- }, a = {
27
+ }, n = {
28
28
  0: "日",
29
29
  1: "一",
30
30
  2: "二",
@@ -35,12 +35,12 @@ function h(o, e) {
35
35
  };
36
36
  /(y+)/.test(e) && (e = e.replace(RegExp.$1, (t.year() + "").substr(4 - RegExp.$1.length))), /(E+)/.test(e) && (e = e.replace(
37
37
  RegExp.$1,
38
- (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "周" : "") + a[t.day() + ""]
38
+ (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "周" : "") + n[t.day() + ""]
39
39
  ));
40
- for (const n in r)
41
- new RegExp("(" + n + ")").test(e) && (e = e.replace(
40
+ for (const a in r)
41
+ new RegExp("(" + a + ")").test(e) && (e = e.replace(
42
42
  RegExp.$1,
43
- RegExp.$1.length === 1 ? r[n] : ("00" + r[n]).substr(("" + r[n]).length)
43
+ RegExp.$1.length === 1 ? r[a] : ("00" + r[a]).substr(("" + r[a]).length)
44
44
  ));
45
45
  return e;
46
46
  }
@@ -69,7 +69,7 @@ function c(o) {
69
69
  function g(o) {
70
70
  const e = l(o).valueOf(), t = l().valueOf(), r = t - e;
71
71
  if (r < 0) return "未来的时间";
72
- const a = [
72
+ const n = [
73
73
  { label: "年", value: 365 * 24 * 60 * 60 * 1e3 },
74
74
  { label: "月", value: 720 * 60 * 60 * 1e3 },
75
75
  { label: "周", value: 10080 * 60 * 1e3 },
@@ -78,22 +78,22 @@ function g(o) {
78
78
  { label: "分钟", value: 60 * 1e3 },
79
79
  { label: "刚刚", value: 10 * 1e3 }
80
80
  ];
81
- if (r < a[a.length - 1].value) return "刚刚";
82
- for (const { label: n, value: u } of a.slice(0, -1)) {
81
+ if (r < n[n.length - 1].value) return "刚刚";
82
+ for (const { label: a, value: u } of n.slice(0, -1)) {
83
83
  const s = r / u;
84
84
  if (s >= 1)
85
- return n === "天" && s < 2 ? s === 1 ? "昨天" : "今天" : `${Math.floor(s)} ${n}前`;
85
+ return a === "天" && s < 2 ? s === 1 ? "昨天" : "今天" : `${Math.floor(s)} ${a}前`;
86
86
  }
87
87
  return "刚刚";
88
88
  }
89
89
  function y(o, e) {
90
90
  if (!o) return "";
91
- const t = l(o), { m: r, d: a, w: n } = c(o);
91
+ const t = l(o), { m: r, d: n, w: a } = c(o);
92
92
  if (e) {
93
93
  const u = l(e);
94
- return t.format("YYYY-MM-DD") === u.format("YYYY-MM-DD") ? `${r}月${a}日 周${n} ${t.format("HH:mm")}-${u.format("HH:mm")}` : `${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`;
94
+ return t.format("YYYY-MM-DD") === u.format("YYYY-MM-DD") ? `${r}月${n}日 周${a} ${t.format("HH:mm")}-${u.format("HH:mm")}` : `${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`;
95
95
  } else
96
- return `${r}月${a}日 周${n} ${t.format("HH:mm")}`;
96
+ return `${r}月${n}日 周${a} ${t.format("HH:mm")}`;
97
97
  }
98
98
  export {
99
99
  f as WEEK_DAY,
package/lib/es/index.js CHANGED
@@ -1,78 +1,80 @@
1
1
  import "./calc/index.js";
2
- import { WEEK_DAY as t, formatActivityTime as a, formatDate as o, formatIosDate as s, getDateDiff as m, getDateParams as p } from "./day/dayjs.js";
3
- import { isArray as f, isBoolean as l, isDate as d, isFile as c, isFunction as u, isMap as x, isNull as g, isNumber as y, isObject as D, isPromise as E, isRegExp as b, isSet as v, isString as A, isUndefined as P } from "./is/is.js";
4
- import { isEmpty as j } from "./is/is-empty.js";
5
- import { depsAreSame as h, isEquals as q } from "./is/is-equals.js";
6
- import { classnames as U } from "./utils/classnames.js";
7
- import { deepClone as B } from "./utils/deep-clone.js";
8
- import { pick as I } from "./utils/pick.js";
9
- import { filterParams as M, filterQuery as N, filtrationEmpty as O, getUrlParam as Q, json2params as R, padQuery as k, params2json as H } from "./utils/query2params.js";
10
- import { ObjectAssign as W, browser as Y, calculateDistance as Z, dictEscape as _, encryptString as z, isBrowser as G, padZero as J, thousands as V, underlineToHump as X } from "./utils/util.js";
11
- import { randomString as rr, uuid as er } from "./utils/uuid.js";
12
- import { validate as tr, validateRequire as ar } from "./validator/validate.js";
13
- import { isCard as sr, isCurrency as mr, isEmail as pr, isIdCard as nr, isMobile as fr, isPassport as lr, isUrl as dr, maxLength as cr, minLength as ur, regs as xr, required as gr, validateType as yr, validation as Dr } from "./validator/validator.js";
14
- import { default as br } from "./calc/calc.js";
2
+ import * as e from "dayjs";
3
+ import { WEEK_DAY as a, formatActivityTime as o, formatDate as s, formatIosDate as m, getDateDiff as p, getDateParams as f } from "./day/dayjs.js";
4
+ import { isArray as l, isBoolean as d, isDate as x, isFile as c, isFunction as u, isMap as g, isNull as y, isNumber as D, isObject as E, isPromise as b, isRegExp as j, isSet as v, isString as A, isUndefined as P } from "./is/is.js";
5
+ import { isEmpty as C } from "./is/is-empty.js";
6
+ import { depsAreSame as q, isEquals as T } from "./is/is-equals.js";
7
+ import { classnames as w } from "./utils/classnames.js";
8
+ import { deepClone as F } from "./utils/deep-clone.js";
9
+ import { pick as L } from "./utils/pick.js";
10
+ import { filterParams as N, filterQuery as O, filtrationEmpty as Q, getUrlParam as R, json2params as k, padQuery as H, params2json as K } from "./utils/query2params.js";
11
+ import { ObjectAssign as Y, browser as Z, calculateDistance as _, dictEscape as z, encryptString as G, isBrowser as J, padZero as V, thousands as X, underlineToHump as $ } from "./utils/util.js";
12
+ import { randomString as er, uuid as ir } from "./utils/uuid.js";
13
+ import { validate as ar, validateRequire as or } from "./validator/validate.js";
14
+ import { isCard as mr, isCurrency as pr, isEmail as fr, isIdCard as nr, isMobile as lr, isPassport as dr, isUrl as xr, maxLength as cr, minLength as ur, regs as gr, required as yr, validateType as Dr, validation as Er } from "./validator/validator.js";
15
+ import { default as jr } from "./calc/calc.js";
15
16
  import { Decimal as Ar } from "./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
16
17
  export {
17
18
  Ar as Decimal,
18
- W as ObjectAssign,
19
- t as WEEK_DAY,
20
- Y as browser,
21
- br as calc,
22
- Z as calculateDistance,
23
- U as classnames,
24
- B as deepClone,
25
- h as depsAreSame,
26
- _ as dictEscape,
27
- z as encryptString,
28
- M as filterParams,
29
- N as filterQuery,
30
- O as filtrationEmpty,
31
- a as formatActivityTime,
32
- o as formatDate,
33
- s as formatIosDate,
34
- m as getDateDiff,
35
- p as getDateParams,
36
- Q as getUrlParam,
37
- f as isArray,
38
- l as isBoolean,
39
- G as isBrowser,
40
- sr as isCard,
41
- mr as isCurrency,
42
- d as isDate,
43
- pr as isEmail,
44
- j as isEmpty,
45
- q as isEquals,
19
+ Y as ObjectAssign,
20
+ a as WEEK_DAY,
21
+ Z as browser,
22
+ jr as calc,
23
+ _ as calculateDistance,
24
+ w as classnames,
25
+ e as dayjs,
26
+ F as deepClone,
27
+ q as depsAreSame,
28
+ z as dictEscape,
29
+ G as encryptString,
30
+ N as filterParams,
31
+ O as filterQuery,
32
+ Q as filtrationEmpty,
33
+ o as formatActivityTime,
34
+ s as formatDate,
35
+ m as formatIosDate,
36
+ p as getDateDiff,
37
+ f as getDateParams,
38
+ R as getUrlParam,
39
+ l as isArray,
40
+ d as isBoolean,
41
+ J as isBrowser,
42
+ mr as isCard,
43
+ pr as isCurrency,
44
+ x as isDate,
45
+ fr as isEmail,
46
+ C as isEmpty,
47
+ T as isEquals,
46
48
  c as isFile,
47
49
  u as isFunction,
48
50
  nr as isIdCard,
49
- x as isMap,
50
- fr as isMobile,
51
- g as isNull,
52
- y as isNumber,
53
- D as isObject,
54
- lr as isPassport,
55
- E as isPromise,
56
- b as isRegExp,
51
+ g as isMap,
52
+ lr as isMobile,
53
+ y as isNull,
54
+ D as isNumber,
55
+ E as isObject,
56
+ dr as isPassport,
57
+ b as isPromise,
58
+ j as isRegExp,
57
59
  v as isSet,
58
60
  A as isString,
59
61
  P as isUndefined,
60
- dr as isUrl,
61
- R as json2params,
62
+ xr as isUrl,
63
+ k as json2params,
62
64
  cr as maxLength,
63
65
  ur as minLength,
64
- k as padQuery,
65
- J as padZero,
66
- H as params2json,
67
- I as pick,
68
- rr as randomString,
69
- xr as regs,
70
- gr as required,
71
- V as thousands,
72
- X as underlineToHump,
73
- er as uuid,
74
- tr as validate,
75
- ar as validateRequire,
76
- yr as validateType,
77
- Dr as validation
66
+ H as padQuery,
67
+ V as padZero,
68
+ K as params2json,
69
+ L as pick,
70
+ er as randomString,
71
+ gr as regs,
72
+ yr as required,
73
+ X as thousands,
74
+ $ as underlineToHump,
75
+ ir as uuid,
76
+ ar as validate,
77
+ or as validateRequire,
78
+ Dr as validateType,
79
+ Er as validation
78
80
  };
@@ -1 +1,3 @@
1
+ import * as dayjs from 'dayjs';
1
2
  export * from './dayjs';
3
+ export { dayjs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacego/turbo-utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "🚀 A universal tool library. It basically covers all the commonly used practical functions. ",
5
5
  "type": "module",
6
6
  "main": "lib/cjs/index.cjs",