@base-web-kits/base-tools-ts 0.9.9 → 0.9.10

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.
@@ -7,7 +7,7 @@ type BaseTime = number | string | Date | dayjs.Dayjs | null | undefined;
7
7
  * @param t 各种规范或不规范的时间
8
8
  * @returns dayjs 实例
9
9
  * @example
10
- * const d = toDayjs('2021-01-01'); // dayjs 实例
10
+ * const d = toDayjs('2021-01-01'); // dayjs 实例 (无参,则默认当前时间)
11
11
  * d.format('YYYY-MM-DD HH:mm:ss'); // "2025-12-10 11:33:16"
12
12
  * d.valueOf(); // 毫秒时间戳,如 1765337596913
13
13
  * d.unix(); // 秒时间戳,如 1765337596
@@ -35,7 +35,7 @@ type BaseTime = number | string | Date | dayjs.Dayjs | null | undefined;
35
35
  * d.diff(t, 'quarter'); // 与t相差的季度数
36
36
  * d.diff(t, 'year'); // 与t相差的年数
37
37
  */
38
- export declare function toDayjs(t: BaseTime, fmt?: dayjs.OptionType): dayjs.Dayjs;
38
+ export declare function toDayjs(t?: BaseTime, fmt?: dayjs.OptionType): dayjs.Dayjs;
39
39
  /**
40
40
  * 获取“前几天”的日期范围
41
41
  * @param offset 正整数天数
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/day/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,oBAAoB,CAAC;AAU5B,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,UAAU,eAmB1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;;;;EAgB7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;EAqBlD;AAED;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/day/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,oBAAoB,CAAC;AAU5B,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,UAAU,eAmB3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;;;;EAgB7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;EAqBlD;AAED;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -45,18 +45,19 @@ __export(index_exports, {
45
45
  attempt: () => attempt_default,
46
46
  before: () => before_default,
47
47
  big: () => big,
48
- bigAdd: () => bigAdd,
49
48
  bigCompare: () => bigCompare,
50
49
  bigDiv: () => bigDiv,
51
50
  bigEqual: () => bigEqual,
52
- bigGt: () => bigGt,
53
- bigGte: () => bigGte,
54
- bigLt: () => bigLt,
55
- bigLte: () => bigLte,
56
- bigMul: () => bigMul,
51
+ bigFixed: () => bigFixed,
52
+ bigGreaterThan: () => bigGreaterThan,
53
+ bigGreaterThanOrEqualTo: () => bigGreaterThanOrEqualTo,
54
+ bigLessThan: () => bigLessThan,
55
+ bigLessThanOrEqual: () => bigLessThanOrEqual,
56
+ bigMinus: () => bigMinus,
57
+ bigPlus: () => bigPlus,
57
58
  bigPow: () => bigPow,
58
59
  bigRound: () => bigRound,
59
- bigSub: () => bigSub,
60
+ bigTimes: () => bigTimes,
60
61
  bind: () => bind_default,
61
62
  bindAll: () => bindAll_default,
62
63
  bindKey: () => bindKey_default,
@@ -370,7 +371,6 @@ __export(index_exports, {
370
371
  toChineseNum: () => toChineseNum,
371
372
  toDayjs: () => toDayjs,
372
373
  toFinite: () => toFinite_default,
373
- toFixed: () => toFixed,
374
374
  toInteger: () => toInteger_default,
375
375
  toIterator: () => toIterator_default,
376
376
  toJSON: () => wrapperValue_default,
@@ -506,24 +506,24 @@ var import_bignumber = __toESM(require("bignumber.js"), 1);
506
506
  function big(x) {
507
507
  return x instanceof import_bignumber.default ? x : new import_bignumber.default(x);
508
508
  }
509
- function bigAdd(a, ...rest2) {
510
- let acc = big(a);
511
- for (const x of rest2) acc = acc.plus(big(x));
509
+ function bigPlus(...rest2) {
510
+ let acc = big(rest2[0]);
511
+ for (const x of rest2.slice(1)) acc = acc.plus(big(x));
512
512
  return acc.toNumber();
513
513
  }
514
- function bigSub(a, ...rest2) {
515
- let acc = big(a);
516
- for (const x of rest2) acc = acc.minus(big(x));
514
+ function bigMinus(...rest2) {
515
+ let acc = big(rest2[0]);
516
+ for (const x of rest2.slice(1)) acc = acc.minus(big(x));
517
517
  return acc.toNumber();
518
518
  }
519
- function bigMul(a, ...rest2) {
520
- let acc = big(a);
521
- for (const x of rest2) acc = acc.times(big(x));
519
+ function bigTimes(...rest2) {
520
+ let acc = big(rest2[0]);
521
+ for (const x of rest2.slice(1)) acc = acc.times(big(x));
522
522
  return acc.toNumber();
523
523
  }
524
- function bigDiv(a, ...rest2) {
525
- let acc = big(a);
526
- for (const x of rest2) acc = acc.div(big(x));
524
+ function bigDiv(...rest2) {
525
+ let acc = big(rest2[0]);
526
+ for (const x of rest2.slice(1)) acc = acc.div(big(x));
527
527
  return acc.toNumber();
528
528
  }
529
529
  function bigPow(x, y) {
@@ -532,7 +532,7 @@ function bigPow(x, y) {
532
532
  function bigRound(x, dp = 0, rm = import_bignumber.default.ROUND_HALF_UP) {
533
533
  return big(x).decimalPlaces(dp, rm).toNumber();
534
534
  }
535
- function toFixed(x, dp = 2, rm = import_bignumber.default.ROUND_HALF_UP) {
535
+ function bigFixed(x, dp = 2, rm = import_bignumber.default.ROUND_HALF_UP) {
536
536
  return big(x).toFixed(dp, rm);
537
537
  }
538
538
  function bigCompare(a, b) {
@@ -541,16 +541,16 @@ function bigCompare(a, b) {
541
541
  function bigEqual(a, b) {
542
542
  return big(a).isEqualTo(big(b));
543
543
  }
544
- function bigGt(a, b) {
544
+ function bigGreaterThan(a, b) {
545
545
  return big(a).isGreaterThan(big(b));
546
546
  }
547
- function bigGte(a, b) {
547
+ function bigGreaterThanOrEqualTo(a, b) {
548
548
  return big(a).isGreaterThanOrEqualTo(big(b));
549
549
  }
550
- function bigLt(a, b) {
550
+ function bigLessThan(a, b) {
551
551
  return big(a).isLessThan(big(b));
552
552
  }
553
- function bigLte(a, b) {
553
+ function bigLessThanOrEqual(a, b) {
554
554
  return big(a).isLessThanOrEqualTo(big(b));
555
555
  }
556
556
 
@@ -8581,18 +8581,19 @@ function isLongitude(s) {
8581
8581
  attempt,
8582
8582
  before,
8583
8583
  big,
8584
- bigAdd,
8585
8584
  bigCompare,
8586
8585
  bigDiv,
8587
8586
  bigEqual,
8588
- bigGt,
8589
- bigGte,
8590
- bigLt,
8591
- bigLte,
8592
- bigMul,
8587
+ bigFixed,
8588
+ bigGreaterThan,
8589
+ bigGreaterThanOrEqualTo,
8590
+ bigLessThan,
8591
+ bigLessThanOrEqual,
8592
+ bigMinus,
8593
+ bigPlus,
8593
8594
  bigPow,
8594
8595
  bigRound,
8595
- bigSub,
8596
+ bigTimes,
8596
8597
  bind,
8597
8598
  bindAll,
8598
8599
  bindKey,
@@ -8906,7 +8907,6 @@ function isLongitude(s) {
8906
8907
  toChineseNum,
8907
8908
  toDayjs,
8908
8909
  toFinite,
8909
- toFixed,
8910
8910
  toInteger,
8911
8911
  toIterator,
8912
8912
  toJSON,