@vope/utils 1.6.2 → 1.6.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/dist/index.cjs.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -20,22 +19,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
19
  // src/index.ts
21
20
  var index_exports = {};
22
21
  __export(index_exports, {
22
+ AggUnit: () => AggUnit,
23
23
  Cron: () => Cron,
24
- DayLastValue: () => DayLastValue,
25
- DigitsValue: () => DigitsValue,
24
+ DayLastUnit: () => DayLastUnit,
25
+ DicRollup: () => DicRollup,
26
26
  FlexTable: () => FlexTable,
27
- InvalidValue: () => InvalidValue,
27
+ InvalidUnit: () => InvalidUnit,
28
28
  MemoryBasic: () => MemoryBasic,
29
29
  MemoryList: () => MemoryList,
30
30
  MemoryPower: () => MemoryPower,
31
31
  MemorySimple: () => MemorySimple,
32
32
  Neo4j: () => Neo4j,
33
33
  Neo4jAhchors: () => Neo4jAhchors,
34
- RangeValue: () => RangeValue,
34
+ RangeUnit: () => RangeUnit,
35
35
  Subscriber: () => Subscriber,
36
36
  Union: () => Union,
37
- WeekLastValue: () => WeekLastValue,
38
- WildcardValue: () => WildcardValue,
37
+ WeekLastUnit: () => WeekLastUnit,
38
+ WildcardUnit: () => WildcardUnit,
39
+ calc: () => calc,
39
40
  clamp: () => clamp,
40
41
  classnames: () => classnames,
41
42
  compareVersion: () => compareVersion,
@@ -66,16 +67,17 @@ __export(index_exports, {
66
67
  hash8object: () => hash8object,
67
68
  hash8strings: () => hash8strings,
68
69
  inputRegex: () => inputRegex,
70
+ isAggUnit: () => isAggUnit,
71
+ isCalc: () => isCalc,
69
72
  isClass: () => isClass,
70
- isDayLastValue: () => isDayLastValue,
71
- isDigitsValue: () => isDigitsValue,
73
+ isDayLastUnit: () => isDayLastUnit,
72
74
  isEmpty: () => isEmpty,
73
- isInvalidValue: () => isInvalidValue,
75
+ isInvalidUnit: () => isInvalidUnit,
74
76
  isKey: () => isKey,
75
77
  isNull: () => isNull,
76
- isRangeValue: () => isRangeValue,
77
- isWeekLastValue: () => isWeekLastValue,
78
- isWildcardValue: () => isWildcardValue,
78
+ isRangeUnit: () => isRangeUnit,
79
+ isWeekLastUnit: () => isWeekLastUnit,
80
+ isWildcardUnit: () => isWildcardUnit,
79
81
  joinPaths: () => joinPaths,
80
82
  loadImage: () => loadImage,
81
83
  once: () => once,
@@ -87,6 +89,26 @@ __export(index_exports, {
87
89
  });
88
90
  module.exports = __toCommonJS(index_exports);
89
91
 
92
+ // src/calc.ts
93
+ var import_lodash_es = require("lodash-es");
94
+ var formatter = (value) => (0, import_lodash_es.isNumber)(value) ? value && `${value}px` : value;
95
+ var isCalc = (value) => value.slice(0, 5) === "calc(" && value.slice(-1) === ")";
96
+ var calc = (...list) => {
97
+ const size = list.length;
98
+ if (size === 0) return 0;
99
+ if (size === 1) return formatter(list[1]);
100
+ const value = list.reduce((caches, value2) => {
101
+ let tmp = formatter(value2);
102
+ if (tmp === 0) return caches;
103
+ if (isCalc(tmp)) {
104
+ tmp = tmp.slice(4);
105
+ }
106
+ return caches ? `${caches} + ${tmp}` : tmp;
107
+ }, "");
108
+ return value === "" ? 0 : `calc(${value})`;
109
+ };
110
+ calc.formatter = formatter;
111
+
90
112
  // src/clamp.ts
91
113
  var clamp = (value, min, max) => {
92
114
  if (min > max) {
@@ -98,14 +120,14 @@ var clamp = (value, min, max) => {
98
120
  };
99
121
 
100
122
  // src/classnames.ts
101
- var import_lodash_es = require("lodash-es");
123
+ var import_lodash_es2 = require("lodash-es");
102
124
  var add = (a, b) => a ? a + " " + b : b;
103
125
  var classnames = (...list) => list.reduce((caches, data) => {
104
- if ((0, import_lodash_es.isString)(data)) {
126
+ if ((0, import_lodash_es2.isString)(data)) {
105
127
  data && (caches = add(caches, data));
106
128
  } else if (Array.isArray(data)) {
107
- data.forEach((value) => value && (0, import_lodash_es.isString)(value) && (caches = add(caches, value)));
108
- } else if (!(0, import_lodash_es.isBoolean)(data)) {
129
+ data.forEach((value) => value && (0, import_lodash_es2.isString)(value) && (caches = add(caches, value)));
130
+ } else if (!(0, import_lodash_es2.isBoolean)(data)) {
109
131
  for (const key in data) {
110
132
  key && data[key] && (caches = add(caches, key));
111
133
  }
@@ -177,7 +199,7 @@ var hash8object = (list, key) => list.reduce((caches, data) => {
177
199
  }, /* @__PURE__ */ new Map());
178
200
 
179
201
  // src/cron.ts
180
- var import_lodash_es2 = require("lodash-es");
202
+ var import_lodash_es3 = require("lodash-es");
181
203
  var {
182
204
  parseInt,
183
205
  isInteger,
@@ -439,7 +461,7 @@ var createCronRegexText = (options = {}) => {
439
461
  enableInvalid
440
462
  };
441
463
  };
442
- var InvalidValue = class {
464
+ var InvalidUnit = class {
443
465
  constructor(isEnableInvalid) {
444
466
  this.isEnableInvalid = isEnableInvalid;
445
467
  }
@@ -447,32 +469,32 @@ var InvalidValue = class {
447
469
  return this.isEnableInvalid ? "?" : "*";
448
470
  }
449
471
  };
450
- var isInvalidValue = (value) => value instanceof InvalidValue;
472
+ var isInvalidUnit = (value) => value instanceof InvalidUnit;
451
473
  var LastValue = class {
452
474
  constructor(value) {
453
475
  this.value = value;
454
476
  }
455
477
  };
456
- var DayLastValue = class extends LastValue {
478
+ var DayLastUnit = class extends LastValue {
457
479
  text() {
458
480
  const { value } = this;
459
481
  return "L" + (value ? `-${value}` : "");
460
482
  }
461
483
  };
462
- var isDayLastValue = (value) => value instanceof DayLastValue;
463
- var WeekLastValue = class extends LastValue {
484
+ var isDayLastUnit = (value) => value instanceof DayLastUnit;
485
+ var WeekLastUnit = class extends LastValue {
464
486
  text() {
465
487
  return `${this.value}L`;
466
488
  }
467
489
  };
468
- var isWeekLastValue = (value) => value instanceof WeekLastValue;
469
- var WildcardValue = class {
490
+ var isWeekLastUnit = (value) => value instanceof WeekLastUnit;
491
+ var WildcardUnit = class {
470
492
  text() {
471
493
  return "*";
472
494
  }
473
495
  };
474
- var isWildcardValue = (value) => value instanceof WildcardValue;
475
- var RangeValue = class {
496
+ var isWildcardUnit = (value) => value instanceof WildcardUnit;
497
+ var RangeUnit = class {
476
498
  constructor(start, stop) {
477
499
  this.start = start;
478
500
  this.stop = stop;
@@ -481,8 +503,8 @@ var RangeValue = class {
481
503
  return `${this.start}-${this.stop}`;
482
504
  }
483
505
  };
484
- var isRangeValue = (value) => value instanceof RangeValue;
485
- var DigitsValue = class {
506
+ var isRangeUnit = (value) => value instanceof RangeUnit;
507
+ var AggUnit = class {
486
508
  constructor(values, increment) {
487
509
  this.values = values;
488
510
  this.increment = increment;
@@ -493,7 +515,7 @@ var DigitsValue = class {
493
515
  if (Array.isArray(values)) {
494
516
  tmp = values.reduce((caches, data) => {
495
517
  let tmp2;
496
- if ((0, import_lodash_es2.isNumber)(data)) {
518
+ if ((0, import_lodash_es3.isNumber)(data)) {
497
519
  tmp2 = `${data}`;
498
520
  } else {
499
521
  tmp2 = data.text();
@@ -506,7 +528,7 @@ var DigitsValue = class {
506
528
  return increment ? `${tmp}/${increment}` : tmp;
507
529
  }
508
530
  };
509
- var isDigitsValue = (value) => value instanceof DigitsValue;
531
+ var isAggUnit = (value) => value instanceof AggUnit;
510
532
  var re_num = /\d/;
511
533
  var parseDigit = (text) => {
512
534
  if (re_num.test(text[0])) {
@@ -515,22 +537,22 @@ var parseDigit = (text) => {
515
537
  return weekDic.item(text.toLocaleUpperCase());
516
538
  }
517
539
  };
518
- var parseDigits = (text) => {
540
+ var parseAgg = (text) => {
519
541
  return text.split(",").map((text2) => {
520
542
  const [a, b] = text2.split("-");
521
543
  if (a === "L" && b === void 0) {
522
- return new DayLastValue(0);
544
+ return new DayLastUnit(0);
523
545
  } else if (b === void 0) {
524
546
  if (a.slice(-1) === "L") {
525
- return new WeekLastValue(parseInt(a.slice(0, -1)));
547
+ return new WeekLastUnit(parseInt(a.slice(0, -1)));
526
548
  } else {
527
549
  return parseDigit(a);
528
550
  }
529
551
  } else {
530
552
  if (a === "L") {
531
- return new DayLastValue(parseInt(b));
553
+ return new DayLastUnit(parseInt(b));
532
554
  } else {
533
- return new RangeValue(parseDigit(a), parseDigit(b));
555
+ return new RangeUnit(parseDigit(a), parseDigit(b));
534
556
  }
535
557
  }
536
558
  });
@@ -548,16 +570,16 @@ var validate = (value, min, max) => {
548
570
  var validateIncrement = (value, min, max) => {
549
571
  return isInteger(value) && value > 0 && value >= min && value <= max;
550
572
  };
551
- var formaterDigits = (value, min, max) => {
573
+ var formaterAgg = (value, min, max) => {
552
574
  let values;
553
575
  if (value === "*") {
554
- values = new WildcardValue();
576
+ values = new WildcardUnit();
555
577
  } else if (Array.isArray(value)) {
556
578
  const tmp = [];
557
579
  value.some((data) => {
558
580
  if (validate(data, min, max)) {
559
581
  tmp.push(
560
- (0, import_lodash_es2.isNumber)(data) ? data : new RangeValue(data[0], data[1])
582
+ (0, import_lodash_es3.isNumber)(data) ? data : new RangeUnit(data[0], data[1])
561
583
  );
562
584
  return false;
563
585
  } else {
@@ -569,23 +591,23 @@ var formaterDigits = (value, min, max) => {
569
591
  }
570
592
  return values;
571
593
  };
572
- var formaterLastDigits = (value, min, max, prototype) => {
594
+ var formaterAggByLast = (value, min, max, prototype) => {
573
595
  let values;
574
596
  if (value === "*") {
575
- values = new WildcardValue();
597
+ values = new WildcardUnit();
576
598
  } else {
577
599
  const tmp = [];
578
600
  const list = Array.isArray(value) ? value : [value];
579
601
  list.some((data) => {
580
- if ((0, import_lodash_es2.isString)(data)) {
581
- const result = parseDigits(data);
602
+ if ((0, import_lodash_es3.isString)(data)) {
603
+ const result = parseAgg(data);
582
604
  if (result.length === 1 && result[0] instanceof prototype && validate(result[0].value, min, max - 1)) {
583
605
  tmp.push(result[0]);
584
606
  return false;
585
607
  }
586
608
  } else if (validate(data, min, max)) {
587
609
  tmp.push(
588
- (0, import_lodash_es2.isNumber)(data) ? data : new RangeValue(data[0], data[1])
610
+ (0, import_lodash_es3.isNumber)(data) ? data : new RangeUnit(data[0], data[1])
589
611
  );
590
612
  return false;
591
613
  }
@@ -617,18 +639,18 @@ var Parse = class {
617
639
  week;
618
640
  year;
619
641
  parse(text) {
620
- if (text === "?") return new InvalidValue(this.cron.isEnableInvalid);
642
+ if (text === "?") return new InvalidUnit(this.cron.isEnableInvalid);
621
643
  const [slices, increment] = text.split("/");
622
- return new DigitsValue(
623
- slices === "*" ? new WildcardValue() : parseDigits(slices),
644
+ return new AggUnit(
645
+ slices === "*" ? new WildcardUnit() : parseAgg(slices),
624
646
  increment ? parseInt(increment) : void 0
625
647
  );
626
648
  }
627
649
  setSecond(value, increment) {
628
650
  if (!this.cron.isEnableSecond) return false;
629
- const values = formaterDigits(value, default_min_second, default_max_second);
651
+ const values = formaterAgg(value, default_min_second, default_max_second);
630
652
  if (!values) return false;
631
- const second = new DigitsValue(values);
653
+ const second = new AggUnit(values);
632
654
  if (validateIncrement(increment, default_min_second, default_max_second)) {
633
655
  second.increment = increment;
634
656
  }
@@ -636,9 +658,9 @@ var Parse = class {
636
658
  return true;
637
659
  }
638
660
  setMinute(value, increment) {
639
- const values = formaterDigits(value, default_min_minute, default_max_minute);
661
+ const values = formaterAgg(value, default_min_minute, default_max_minute);
640
662
  if (!values) return false;
641
- const minute = new DigitsValue(values);
663
+ const minute = new AggUnit(values);
642
664
  if (validateIncrement(increment, default_min_minute, default_max_minute)) {
643
665
  minute.increment = increment;
644
666
  }
@@ -646,9 +668,9 @@ var Parse = class {
646
668
  return true;
647
669
  }
648
670
  setHour(value, increment) {
649
- const values = formaterDigits(value, default_min_hour, default_max_hour);
671
+ const values = formaterAgg(value, default_min_hour, default_max_hour);
650
672
  if (!values) return false;
651
- const hour = new DigitsValue(values);
673
+ const hour = new AggUnit(values);
652
674
  if (validateIncrement(increment, default_min_hour, default_max_hour)) {
653
675
  hour.increment = increment;
654
676
  }
@@ -656,9 +678,9 @@ var Parse = class {
656
678
  return true;
657
679
  }
658
680
  setDayInvalid() {
659
- this.day = new InvalidValue(this.cron.isEnableInvalid);
660
- if (this.week instanceof InvalidValue) {
661
- this.week = new DigitsValue(new WildcardValue());
681
+ this.day = new InvalidUnit(this.cron.isEnableInvalid);
682
+ if (this.week instanceof InvalidUnit) {
683
+ this.week = new AggUnit(new WildcardUnit());
662
684
  }
663
685
  }
664
686
  setDay(value, increment) {
@@ -667,30 +689,30 @@ var Parse = class {
667
689
  this.setDayInvalid();
668
690
  return true;
669
691
  } else {
670
- const tmp2 = formaterLastDigits(value, default_min_day, default_max_day, DayLastValue);
692
+ const tmp2 = formaterAggByLast(value, default_min_day, default_max_day, DayLastUnit);
671
693
  if (!tmp2) return false;
672
694
  values = tmp2;
673
695
  }
674
- const tmp = new DigitsValue(values);
696
+ const tmp = new AggUnit(values);
675
697
  if (validateIncrement(increment, default_min_day, default_max_day)) {
676
698
  tmp.increment = increment;
677
699
  }
678
700
  this.day = tmp;
679
701
  const { week } = this;
680
- if (isDigitsValue(week) && (week.increment !== void 0 || !isWildcardValue(week.values))) {
702
+ if (isAggUnit(week) && (week.increment !== void 0 || !isWildcardUnit(week.values))) {
681
703
  if (this.cron.isEnableInvalid) {
682
- this.week = new InvalidValue(true);
704
+ this.week = new InvalidUnit(true);
683
705
  } else {
684
- week.values = new WildcardValue();
706
+ week.values = new WildcardUnit();
685
707
  week.increment = void 0;
686
708
  }
687
709
  }
688
710
  return true;
689
711
  }
690
712
  setMonth(value, increment) {
691
- const values = formaterDigits(value, default_min_month, default_max_month);
713
+ const values = formaterAgg(value, default_min_month, default_max_month);
692
714
  if (!values) return false;
693
- const month = new DigitsValue(values);
715
+ const month = new AggUnit(values);
694
716
  if (validateIncrement(increment, default_min_month, default_max_month)) {
695
717
  month.increment = increment;
696
718
  }
@@ -698,9 +720,9 @@ var Parse = class {
698
720
  return true;
699
721
  }
700
722
  setWeekInvalid() {
701
- this.week = new InvalidValue(this.cron.isEnableInvalid);
702
- if (this.day instanceof InvalidValue) {
703
- this.day = new DigitsValue(new WildcardValue());
723
+ this.week = new InvalidUnit(this.cron.isEnableInvalid);
724
+ if (this.day instanceof InvalidUnit) {
725
+ this.day = new AggUnit(new WildcardUnit());
704
726
  }
705
727
  }
706
728
  setWeek(value, increment) {
@@ -709,21 +731,21 @@ var Parse = class {
709
731
  this.setWeekInvalid();
710
732
  return true;
711
733
  } else {
712
- const tmp2 = formaterLastDigits(value, default_min_week, default_max_week, WeekLastValue);
734
+ const tmp2 = formaterAggByLast(value, default_min_week, default_max_week, WeekLastUnit);
713
735
  if (!tmp2) return false;
714
736
  values = tmp2;
715
737
  }
716
- const tmp = new DigitsValue(values);
738
+ const tmp = new AggUnit(values);
717
739
  if (validateIncrement(increment, default_min_week, default_max_week)) {
718
740
  tmp.increment = increment;
719
741
  }
720
742
  this.week = tmp;
721
743
  const { day } = this;
722
- if (isDigitsValue(day) && (day.increment !== void 0 || !isWildcardValue(day.values))) {
744
+ if (isAggUnit(day) && (day.increment !== void 0 || !isWildcardUnit(day.values))) {
723
745
  if (this.cron.isEnableInvalid) {
724
- this.day = new InvalidValue(true);
746
+ this.day = new InvalidUnit(true);
725
747
  } else {
726
- day.values = new WildcardValue();
748
+ day.values = new WildcardUnit();
727
749
  day.increment = void 0;
728
750
  }
729
751
  }
@@ -731,9 +753,9 @@ var Parse = class {
731
753
  }
732
754
  setYear(value, increment) {
733
755
  if (!this.cron.isEnableYear) return false;
734
- const values = formaterDigits(value, 0, MAX_SAFE_INTEGER);
756
+ const values = formaterAgg(value, 0, MAX_SAFE_INTEGER);
735
757
  if (!values) return false;
736
- const year = new DigitsValue(values);
758
+ const year = new AggUnit(values);
737
759
  if (validateIncrement(increment, 0, MAX_SAFE_INTEGER)) {
738
760
  year.increment = increment;
739
761
  }
@@ -823,7 +845,7 @@ var Cron = class {
823
845
  };
824
846
 
825
847
  // src/desens.ts
826
- var import_lodash_es3 = require("lodash-es");
848
+ var import_lodash_es4 = require("lodash-es");
827
849
  var desensEncrypt = (plaintext, encrypt) => {
828
850
  const rules = [];
829
851
  let point = -1;
@@ -862,7 +884,7 @@ var desensReplace = (ciphertext, rules, replacer = "*") => {
862
884
  return rules.reduce((cache, { range: [start, stop], modify }) => {
863
885
  const part = ciphertext.slice(start + offset, start + offset + modify);
864
886
  const size = stop + 1 - start;
865
- const replaceValue = (0, import_lodash_es3.isString)(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
887
+ const replaceValue = (0, import_lodash_es4.isString)(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
866
888
  cache += ciphertext.slice(from, start + offset) + replaceValue;
867
889
  from = start + offset + modify;
868
890
  offset += modify - size;
@@ -870,6 +892,97 @@ var desensReplace = (ciphertext, rules, replacer = "*") => {
870
892
  }, "") + ciphertext.slice(from);
871
893
  };
872
894
 
895
+ // src/dic.ts
896
+ var import_lodash_es5 = require("lodash-es");
897
+ var DicRollup = class _DicRollup {
898
+ #list;
899
+ #default;
900
+ #customLabel;
901
+ memory;
902
+ constructor(list, {
903
+ defaultValue,
904
+ customLabel
905
+ } = {}) {
906
+ this.#list = list;
907
+ this.#default = defaultValue;
908
+ this.#customLabel = customLabel;
909
+ const getter = () => hash8json(list, "value");
910
+ Object.defineProperty(this, "memory", {
911
+ get() {
912
+ return getter();
913
+ }
914
+ });
915
+ }
916
+ get size() {
917
+ return this.#list.length;
918
+ }
919
+ get default() {
920
+ return this.#default;
921
+ }
922
+ get list() {
923
+ return this.#list;
924
+ }
925
+ includes(key) {
926
+ return key in this.memory;
927
+ }
928
+ label(key, mode) {
929
+ const data = this.memory[key];
930
+ if (!data) return;
931
+ const custom = this.#customLabel;
932
+ if (!custom) return data.label;
933
+ if (!mode && (0, import_lodash_es5.isFunction)(custom)) {
934
+ return custom(data);
935
+ } else if (mode) {
936
+ const tmp = custom[mode];
937
+ return tmp ? tmp(data) : data.label;
938
+ } else {
939
+ return data.label;
940
+ }
941
+ }
942
+ get(key, property) {
943
+ return this.memory[key]?.[property];
944
+ }
945
+ item(key) {
946
+ return this.memory[key];
947
+ }
948
+ map(callback) {
949
+ return this.#list.map(callback);
950
+ }
951
+ reduce(callback, initialValue) {
952
+ return this.#list.reduce(callback, initialValue);
953
+ }
954
+ copy(keys, options) {
955
+ const tmp = hash8strings(keys);
956
+ const opts = Object.assign({
957
+ defaultValue: this.#default,
958
+ customLabel: this.#customLabel
959
+ }, options);
960
+ const { defaultValue } = opts;
961
+ if (defaultValue !== void 0 && defaultValue in tmp === false) {
962
+ opts.defaultValue = void 0;
963
+ }
964
+ return new _DicRollup(
965
+ this.#list.filter((data) => data.value in tmp),
966
+ opts
967
+ );
968
+ }
969
+ copyAnti(keys, options) {
970
+ const tmp = hash8strings(keys);
971
+ const opts = Object.assign({
972
+ defaultValue: this.#default,
973
+ customLabel: this.#customLabel
974
+ }, options);
975
+ const { defaultValue } = opts;
976
+ if (defaultValue !== void 0 && defaultValue in tmp) {
977
+ opts.defaultValue = void 0;
978
+ }
979
+ return new _DicRollup(
980
+ this.#list.filter((data) => data.value in tmp === false),
981
+ opts
982
+ );
983
+ }
984
+ };
985
+
873
986
  // src/encoding.ts
874
987
  var utf8_first_prefix = /^1{2,}/g;
875
988
  var utf8_other_prefix = /^10/;
@@ -1612,17 +1725,18 @@ var once = (func, thisArg) => {
1612
1725
  };
1613
1726
 
1614
1727
  // src/parse/num.ts
1615
- var import_lodash_es4 = require("lodash-es");
1616
- var pow = Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));
1728
+ var import_lodash_es6 = require("lodash-es");
1729
+ var { MAX_SAFE_INTEGER: MAX_SAFE_INTEGER2, NaN } = Number;
1730
+ var pow = Math.floor(Math.log10(MAX_SAFE_INTEGER2));
1617
1731
  var re_num2 = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
1618
1732
  var parseNum = (num) => {
1619
- if ((0, import_lodash_es4.isNumber)(num) || typeof num === "bigint") return num;
1733
+ if ((0, import_lodash_es6.isNumber)(num) || typeof num === "bigint") return num;
1620
1734
  const match = num.match(re_num2);
1621
- if (!match) return Number.NaN;
1735
+ if (!match) return NaN;
1622
1736
  const [, valueSymbol, integer, bigint, decimal, powSymbol, powValue] = match;
1623
1737
  if (bigint === "n") return BigInt(valueSymbol + integer);
1624
1738
  const powSize = integer.length - 1 + (powValue ? powSymbol === "-" ? -powValue : +powValue : 0);
1625
- if (powSize < pow || powSize === pow && +integer.slice(0, -1) < Number.MAX_SAFE_INTEGER / 10) return +num;
1739
+ if (powSize < pow || powSize === pow && +integer.slice(0, -1) < MAX_SAFE_INTEGER2 / 10) return +num;
1626
1740
  try {
1627
1741
  const bigValue = BigInt(integer.slice(0, powSize + 1).padEnd(powSize + 1, "0"));
1628
1742
  let smallValue;
@@ -1637,7 +1751,7 @@ var parseNum = (num) => {
1637
1751
  const value = bigValue + smallValue;
1638
1752
  return valueSymbol === "-" ? value * BigInt(-1) : value;
1639
1753
  } catch {
1640
- return Number.NaN;
1754
+ return NaN;
1641
1755
  }
1642
1756
  };
1643
1757
 
@@ -1645,7 +1759,7 @@ var parseNum = (num) => {
1645
1759
  var rotateAngle = (from, angle, visit) => rotateRad(from, angle / 180 * Math.PI, visit);
1646
1760
 
1647
1761
  // src/serialize/url-params.ts
1648
- var import_lodash_es5 = require("lodash-es");
1762
+ var import_lodash_es7 = require("lodash-es");
1649
1763
  var cubes = {
1650
1764
  string: (text) => text,
1651
1765
  boolean: (text) => text === "true",
@@ -1670,7 +1784,7 @@ var cubeURLParams = (text, serializes) => {
1670
1784
  for (const [key, value] of params) {
1671
1785
  const serialize = serializes[key];
1672
1786
  if (!serialize) continue;
1673
- if ((0, import_lodash_es5.isString)(serialize) && isKey(serialize, cubes)) {
1787
+ if ((0, import_lodash_es7.isString)(serialize) && isKey(serialize, cubes)) {
1674
1788
  result[key] = cubes[serialize](value);
1675
1789
  } else {
1676
1790
  result[key] = serialize.cube(value);
@@ -1688,21 +1802,21 @@ var flatURLParams = (data, serializes) => {
1688
1802
  if (!serialize) continue;
1689
1803
  params.append(
1690
1804
  key,
1691
- (0, import_lodash_es5.isString)(serialize) && isKey(serialize, flats) ? flats[serialize](value) : serialize.flat(value)
1805
+ (0, import_lodash_es7.isString)(serialize) && isKey(serialize, flats) ? flats[serialize](value) : serialize.flat(value)
1692
1806
  );
1693
1807
  }
1694
1808
  return params.toString();
1695
1809
  };
1696
1810
 
1697
1811
  // src/style/css.ts
1698
- var import_lodash_es6 = require("lodash-es");
1812
+ var import_lodash_es8 = require("lodash-es");
1699
1813
  var hump = /[A-Z]/g;
1700
1814
  var css = (...args) => {
1701
1815
  const list = [];
1702
1816
  for (let i = 0; i < args.length; i++) {
1703
1817
  const data = args[i];
1704
1818
  if (!data) continue;
1705
- if ((0, import_lodash_es6.isString)(data)) {
1819
+ if ((0, import_lodash_es8.isString)(data)) {
1706
1820
  list.push(data);
1707
1821
  } else if (Array.isArray(data)) {
1708
1822
  const result = css(...data);
@@ -1876,9 +1990,9 @@ var FlexTable = class {
1876
1990
 
1877
1991
  // src/union.ts
1878
1992
  var Union = class {
1879
- constructor(key, formatter) {
1993
+ constructor(key, formatter2) {
1880
1994
  this.key = key;
1881
- this.formatter = formatter;
1995
+ this.formatter = formatter2;
1882
1996
  }
1883
1997
  #data = {};
1884
1998
  #options = {};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { type Calc, isCalc, calc } from './calc';
1
2
  export { clamp } from './clamp';
2
3
  export { classnames } from './classnames';
3
4
  export { compareVersion } from './compare/version';
@@ -5,8 +6,9 @@ export { deepWeakEqual } from './compare/weak-equal';
5
6
  export { hash8json } from './convert/json';
6
7
  export { hash8object } from './convert/object';
7
8
  export { hash8strings } from './convert/strings';
8
- export { weekDic, default_max_second, default_min_second, default_max_minute, default_min_minute, default_max_hour, default_min_hour, default_max_day, default_min_day, default_max_month, default_min_month, default_max_week, default_min_week, createCronRegexText, InvalidValue, isInvalidValue, DayLastValue, isDayLastValue, WeekLastValue, isWeekLastValue, WildcardValue, isWildcardValue, RangeValue, isRangeValue, DigitsValue, isDigitsValue, Cron } from './cron';
9
+ export { weekDic, default_max_second, default_min_second, default_max_minute, default_min_minute, default_max_hour, default_min_hour, default_max_day, default_min_day, default_max_month, default_min_month, default_max_week, default_min_week, createCronRegexText, InvalidUnit, isInvalidUnit, DayLastUnit, isDayLastUnit, WeekLastUnit, isWeekLastUnit, WildcardUnit, isWildcardUnit, RangeUnit, isRangeUnit, AggUnit, isAggUnit, Cron } from './cron';
9
10
  export { type DesensDecrypt, type DesensEncrypt, desensEncrypt, desensDecrypt, desensReplace } from './desens';
11
+ export { type Dic, default as DicRollup } from './dic';
10
12
  export { getEncoding } from './encoding';
11
13
  export { inputRegex } from './input-regex';
12
14
  export { isClass } from './is/class';