@vope/utils 1.6.3 → 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
@@ -19,22 +19,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/index.ts
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ AggUnit: () => AggUnit,
22
23
  Cron: () => Cron,
23
- DayLastValue: () => DayLastValue,
24
- DigitsValue: () => DigitsValue,
24
+ DayLastUnit: () => DayLastUnit,
25
+ DicRollup: () => DicRollup,
25
26
  FlexTable: () => FlexTable,
26
- InvalidValue: () => InvalidValue,
27
+ InvalidUnit: () => InvalidUnit,
27
28
  MemoryBasic: () => MemoryBasic,
28
29
  MemoryList: () => MemoryList,
29
30
  MemoryPower: () => MemoryPower,
30
31
  MemorySimple: () => MemorySimple,
31
32
  Neo4j: () => Neo4j,
32
33
  Neo4jAhchors: () => Neo4jAhchors,
33
- RangeValue: () => RangeValue,
34
+ RangeUnit: () => RangeUnit,
34
35
  Subscriber: () => Subscriber,
35
36
  Union: () => Union,
36
- WeekLastValue: () => WeekLastValue,
37
- WildcardValue: () => WildcardValue,
37
+ WeekLastUnit: () => WeekLastUnit,
38
+ WildcardUnit: () => WildcardUnit,
38
39
  calc: () => calc,
39
40
  clamp: () => clamp,
40
41
  classnames: () => classnames,
@@ -66,17 +67,17 @@ __export(index_exports, {
66
67
  hash8object: () => hash8object,
67
68
  hash8strings: () => hash8strings,
68
69
  inputRegex: () => inputRegex,
70
+ isAggUnit: () => isAggUnit,
69
71
  isCalc: () => isCalc,
70
72
  isClass: () => isClass,
71
- isDayLastValue: () => isDayLastValue,
72
- isDigitsValue: () => isDigitsValue,
73
+ isDayLastUnit: () => isDayLastUnit,
73
74
  isEmpty: () => isEmpty,
74
- isInvalidValue: () => isInvalidValue,
75
+ isInvalidUnit: () => isInvalidUnit,
75
76
  isKey: () => isKey,
76
77
  isNull: () => isNull,
77
- isRangeValue: () => isRangeValue,
78
- isWeekLastValue: () => isWeekLastValue,
79
- isWildcardValue: () => isWildcardValue,
78
+ isRangeUnit: () => isRangeUnit,
79
+ isWeekLastUnit: () => isWeekLastUnit,
80
+ isWildcardUnit: () => isWildcardUnit,
80
81
  joinPaths: () => joinPaths,
81
82
  loadImage: () => loadImage,
82
83
  once: () => once,
@@ -460,7 +461,7 @@ var createCronRegexText = (options = {}) => {
460
461
  enableInvalid
461
462
  };
462
463
  };
463
- var InvalidValue = class {
464
+ var InvalidUnit = class {
464
465
  constructor(isEnableInvalid) {
465
466
  this.isEnableInvalid = isEnableInvalid;
466
467
  }
@@ -468,32 +469,32 @@ var InvalidValue = class {
468
469
  return this.isEnableInvalid ? "?" : "*";
469
470
  }
470
471
  };
471
- var isInvalidValue = (value) => value instanceof InvalidValue;
472
+ var isInvalidUnit = (value) => value instanceof InvalidUnit;
472
473
  var LastValue = class {
473
474
  constructor(value) {
474
475
  this.value = value;
475
476
  }
476
477
  };
477
- var DayLastValue = class extends LastValue {
478
+ var DayLastUnit = class extends LastValue {
478
479
  text() {
479
480
  const { value } = this;
480
481
  return "L" + (value ? `-${value}` : "");
481
482
  }
482
483
  };
483
- var isDayLastValue = (value) => value instanceof DayLastValue;
484
- var WeekLastValue = class extends LastValue {
484
+ var isDayLastUnit = (value) => value instanceof DayLastUnit;
485
+ var WeekLastUnit = class extends LastValue {
485
486
  text() {
486
487
  return `${this.value}L`;
487
488
  }
488
489
  };
489
- var isWeekLastValue = (value) => value instanceof WeekLastValue;
490
- var WildcardValue = class {
490
+ var isWeekLastUnit = (value) => value instanceof WeekLastUnit;
491
+ var WildcardUnit = class {
491
492
  text() {
492
493
  return "*";
493
494
  }
494
495
  };
495
- var isWildcardValue = (value) => value instanceof WildcardValue;
496
- var RangeValue = class {
496
+ var isWildcardUnit = (value) => value instanceof WildcardUnit;
497
+ var RangeUnit = class {
497
498
  constructor(start, stop) {
498
499
  this.start = start;
499
500
  this.stop = stop;
@@ -502,8 +503,8 @@ var RangeValue = class {
502
503
  return `${this.start}-${this.stop}`;
503
504
  }
504
505
  };
505
- var isRangeValue = (value) => value instanceof RangeValue;
506
- var DigitsValue = class {
506
+ var isRangeUnit = (value) => value instanceof RangeUnit;
507
+ var AggUnit = class {
507
508
  constructor(values, increment) {
508
509
  this.values = values;
509
510
  this.increment = increment;
@@ -527,7 +528,7 @@ var DigitsValue = class {
527
528
  return increment ? `${tmp}/${increment}` : tmp;
528
529
  }
529
530
  };
530
- var isDigitsValue = (value) => value instanceof DigitsValue;
531
+ var isAggUnit = (value) => value instanceof AggUnit;
531
532
  var re_num = /\d/;
532
533
  var parseDigit = (text) => {
533
534
  if (re_num.test(text[0])) {
@@ -536,22 +537,22 @@ var parseDigit = (text) => {
536
537
  return weekDic.item(text.toLocaleUpperCase());
537
538
  }
538
539
  };
539
- var parseDigits = (text) => {
540
+ var parseAgg = (text) => {
540
541
  return text.split(",").map((text2) => {
541
542
  const [a, b] = text2.split("-");
542
543
  if (a === "L" && b === void 0) {
543
- return new DayLastValue(0);
544
+ return new DayLastUnit(0);
544
545
  } else if (b === void 0) {
545
546
  if (a.slice(-1) === "L") {
546
- return new WeekLastValue(parseInt(a.slice(0, -1)));
547
+ return new WeekLastUnit(parseInt(a.slice(0, -1)));
547
548
  } else {
548
549
  return parseDigit(a);
549
550
  }
550
551
  } else {
551
552
  if (a === "L") {
552
- return new DayLastValue(parseInt(b));
553
+ return new DayLastUnit(parseInt(b));
553
554
  } else {
554
- return new RangeValue(parseDigit(a), parseDigit(b));
555
+ return new RangeUnit(parseDigit(a), parseDigit(b));
555
556
  }
556
557
  }
557
558
  });
@@ -569,16 +570,16 @@ var validate = (value, min, max) => {
569
570
  var validateIncrement = (value, min, max) => {
570
571
  return isInteger(value) && value > 0 && value >= min && value <= max;
571
572
  };
572
- var formaterDigits = (value, min, max) => {
573
+ var formaterAgg = (value, min, max) => {
573
574
  let values;
574
575
  if (value === "*") {
575
- values = new WildcardValue();
576
+ values = new WildcardUnit();
576
577
  } else if (Array.isArray(value)) {
577
578
  const tmp = [];
578
579
  value.some((data) => {
579
580
  if (validate(data, min, max)) {
580
581
  tmp.push(
581
- (0, import_lodash_es3.isNumber)(data) ? data : new RangeValue(data[0], data[1])
582
+ (0, import_lodash_es3.isNumber)(data) ? data : new RangeUnit(data[0], data[1])
582
583
  );
583
584
  return false;
584
585
  } else {
@@ -590,23 +591,23 @@ var formaterDigits = (value, min, max) => {
590
591
  }
591
592
  return values;
592
593
  };
593
- var formaterLastDigits = (value, min, max, prototype) => {
594
+ var formaterAggByLast = (value, min, max, prototype) => {
594
595
  let values;
595
596
  if (value === "*") {
596
- values = new WildcardValue();
597
+ values = new WildcardUnit();
597
598
  } else {
598
599
  const tmp = [];
599
600
  const list = Array.isArray(value) ? value : [value];
600
601
  list.some((data) => {
601
602
  if ((0, import_lodash_es3.isString)(data)) {
602
- const result = parseDigits(data);
603
+ const result = parseAgg(data);
603
604
  if (result.length === 1 && result[0] instanceof prototype && validate(result[0].value, min, max - 1)) {
604
605
  tmp.push(result[0]);
605
606
  return false;
606
607
  }
607
608
  } else if (validate(data, min, max)) {
608
609
  tmp.push(
609
- (0, import_lodash_es3.isNumber)(data) ? data : new RangeValue(data[0], data[1])
610
+ (0, import_lodash_es3.isNumber)(data) ? data : new RangeUnit(data[0], data[1])
610
611
  );
611
612
  return false;
612
613
  }
@@ -638,18 +639,18 @@ var Parse = class {
638
639
  week;
639
640
  year;
640
641
  parse(text) {
641
- if (text === "?") return new InvalidValue(this.cron.isEnableInvalid);
642
+ if (text === "?") return new InvalidUnit(this.cron.isEnableInvalid);
642
643
  const [slices, increment] = text.split("/");
643
- return new DigitsValue(
644
- slices === "*" ? new WildcardValue() : parseDigits(slices),
644
+ return new AggUnit(
645
+ slices === "*" ? new WildcardUnit() : parseAgg(slices),
645
646
  increment ? parseInt(increment) : void 0
646
647
  );
647
648
  }
648
649
  setSecond(value, increment) {
649
650
  if (!this.cron.isEnableSecond) return false;
650
- const values = formaterDigits(value, default_min_second, default_max_second);
651
+ const values = formaterAgg(value, default_min_second, default_max_second);
651
652
  if (!values) return false;
652
- const second = new DigitsValue(values);
653
+ const second = new AggUnit(values);
653
654
  if (validateIncrement(increment, default_min_second, default_max_second)) {
654
655
  second.increment = increment;
655
656
  }
@@ -657,9 +658,9 @@ var Parse = class {
657
658
  return true;
658
659
  }
659
660
  setMinute(value, increment) {
660
- const values = formaterDigits(value, default_min_minute, default_max_minute);
661
+ const values = formaterAgg(value, default_min_minute, default_max_minute);
661
662
  if (!values) return false;
662
- const minute = new DigitsValue(values);
663
+ const minute = new AggUnit(values);
663
664
  if (validateIncrement(increment, default_min_minute, default_max_minute)) {
664
665
  minute.increment = increment;
665
666
  }
@@ -667,9 +668,9 @@ var Parse = class {
667
668
  return true;
668
669
  }
669
670
  setHour(value, increment) {
670
- const values = formaterDigits(value, default_min_hour, default_max_hour);
671
+ const values = formaterAgg(value, default_min_hour, default_max_hour);
671
672
  if (!values) return false;
672
- const hour = new DigitsValue(values);
673
+ const hour = new AggUnit(values);
673
674
  if (validateIncrement(increment, default_min_hour, default_max_hour)) {
674
675
  hour.increment = increment;
675
676
  }
@@ -677,9 +678,9 @@ var Parse = class {
677
678
  return true;
678
679
  }
679
680
  setDayInvalid() {
680
- this.day = new InvalidValue(this.cron.isEnableInvalid);
681
- if (this.week instanceof InvalidValue) {
682
- 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());
683
684
  }
684
685
  }
685
686
  setDay(value, increment) {
@@ -688,30 +689,30 @@ var Parse = class {
688
689
  this.setDayInvalid();
689
690
  return true;
690
691
  } else {
691
- const tmp2 = formaterLastDigits(value, default_min_day, default_max_day, DayLastValue);
692
+ const tmp2 = formaterAggByLast(value, default_min_day, default_max_day, DayLastUnit);
692
693
  if (!tmp2) return false;
693
694
  values = tmp2;
694
695
  }
695
- const tmp = new DigitsValue(values);
696
+ const tmp = new AggUnit(values);
696
697
  if (validateIncrement(increment, default_min_day, default_max_day)) {
697
698
  tmp.increment = increment;
698
699
  }
699
700
  this.day = tmp;
700
701
  const { week } = this;
701
- if (isDigitsValue(week) && (week.increment !== void 0 || !isWildcardValue(week.values))) {
702
+ if (isAggUnit(week) && (week.increment !== void 0 || !isWildcardUnit(week.values))) {
702
703
  if (this.cron.isEnableInvalid) {
703
- this.week = new InvalidValue(true);
704
+ this.week = new InvalidUnit(true);
704
705
  } else {
705
- week.values = new WildcardValue();
706
+ week.values = new WildcardUnit();
706
707
  week.increment = void 0;
707
708
  }
708
709
  }
709
710
  return true;
710
711
  }
711
712
  setMonth(value, increment) {
712
- const values = formaterDigits(value, default_min_month, default_max_month);
713
+ const values = formaterAgg(value, default_min_month, default_max_month);
713
714
  if (!values) return false;
714
- const month = new DigitsValue(values);
715
+ const month = new AggUnit(values);
715
716
  if (validateIncrement(increment, default_min_month, default_max_month)) {
716
717
  month.increment = increment;
717
718
  }
@@ -719,9 +720,9 @@ var Parse = class {
719
720
  return true;
720
721
  }
721
722
  setWeekInvalid() {
722
- this.week = new InvalidValue(this.cron.isEnableInvalid);
723
- if (this.day instanceof InvalidValue) {
724
- 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());
725
726
  }
726
727
  }
727
728
  setWeek(value, increment) {
@@ -730,21 +731,21 @@ var Parse = class {
730
731
  this.setWeekInvalid();
731
732
  return true;
732
733
  } else {
733
- const tmp2 = formaterLastDigits(value, default_min_week, default_max_week, WeekLastValue);
734
+ const tmp2 = formaterAggByLast(value, default_min_week, default_max_week, WeekLastUnit);
734
735
  if (!tmp2) return false;
735
736
  values = tmp2;
736
737
  }
737
- const tmp = new DigitsValue(values);
738
+ const tmp = new AggUnit(values);
738
739
  if (validateIncrement(increment, default_min_week, default_max_week)) {
739
740
  tmp.increment = increment;
740
741
  }
741
742
  this.week = tmp;
742
743
  const { day } = this;
743
- if (isDigitsValue(day) && (day.increment !== void 0 || !isWildcardValue(day.values))) {
744
+ if (isAggUnit(day) && (day.increment !== void 0 || !isWildcardUnit(day.values))) {
744
745
  if (this.cron.isEnableInvalid) {
745
- this.day = new InvalidValue(true);
746
+ this.day = new InvalidUnit(true);
746
747
  } else {
747
- day.values = new WildcardValue();
748
+ day.values = new WildcardUnit();
748
749
  day.increment = void 0;
749
750
  }
750
751
  }
@@ -752,9 +753,9 @@ var Parse = class {
752
753
  }
753
754
  setYear(value, increment) {
754
755
  if (!this.cron.isEnableYear) return false;
755
- const values = formaterDigits(value, 0, MAX_SAFE_INTEGER);
756
+ const values = formaterAgg(value, 0, MAX_SAFE_INTEGER);
756
757
  if (!values) return false;
757
- const year = new DigitsValue(values);
758
+ const year = new AggUnit(values);
758
759
  if (validateIncrement(increment, 0, MAX_SAFE_INTEGER)) {
759
760
  year.increment = increment;
760
761
  }
@@ -891,6 +892,97 @@ var desensReplace = (ciphertext, rules, replacer = "*") => {
891
892
  }, "") + ciphertext.slice(from);
892
893
  };
893
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
+
894
986
  // src/encoding.ts
895
987
  var utf8_first_prefix = /^1{2,}/g;
896
988
  var utf8_other_prefix = /^10/;
@@ -1633,17 +1725,18 @@ var once = (func, thisArg) => {
1633
1725
  };
1634
1726
 
1635
1727
  // src/parse/num.ts
1636
- var import_lodash_es5 = require("lodash-es");
1637
- 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));
1638
1731
  var re_num2 = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
1639
1732
  var parseNum = (num) => {
1640
- if ((0, import_lodash_es5.isNumber)(num) || typeof num === "bigint") return num;
1733
+ if ((0, import_lodash_es6.isNumber)(num) || typeof num === "bigint") return num;
1641
1734
  const match = num.match(re_num2);
1642
- if (!match) return Number.NaN;
1735
+ if (!match) return NaN;
1643
1736
  const [, valueSymbol, integer, bigint, decimal, powSymbol, powValue] = match;
1644
1737
  if (bigint === "n") return BigInt(valueSymbol + integer);
1645
1738
  const powSize = integer.length - 1 + (powValue ? powSymbol === "-" ? -powValue : +powValue : 0);
1646
- 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;
1647
1740
  try {
1648
1741
  const bigValue = BigInt(integer.slice(0, powSize + 1).padEnd(powSize + 1, "0"));
1649
1742
  let smallValue;
@@ -1658,7 +1751,7 @@ var parseNum = (num) => {
1658
1751
  const value = bigValue + smallValue;
1659
1752
  return valueSymbol === "-" ? value * BigInt(-1) : value;
1660
1753
  } catch {
1661
- return Number.NaN;
1754
+ return NaN;
1662
1755
  }
1663
1756
  };
1664
1757
 
@@ -1666,7 +1759,7 @@ var parseNum = (num) => {
1666
1759
  var rotateAngle = (from, angle, visit) => rotateRad(from, angle / 180 * Math.PI, visit);
1667
1760
 
1668
1761
  // src/serialize/url-params.ts
1669
- var import_lodash_es6 = require("lodash-es");
1762
+ var import_lodash_es7 = require("lodash-es");
1670
1763
  var cubes = {
1671
1764
  string: (text) => text,
1672
1765
  boolean: (text) => text === "true",
@@ -1691,7 +1784,7 @@ var cubeURLParams = (text, serializes) => {
1691
1784
  for (const [key, value] of params) {
1692
1785
  const serialize = serializes[key];
1693
1786
  if (!serialize) continue;
1694
- if ((0, import_lodash_es6.isString)(serialize) && isKey(serialize, cubes)) {
1787
+ if ((0, import_lodash_es7.isString)(serialize) && isKey(serialize, cubes)) {
1695
1788
  result[key] = cubes[serialize](value);
1696
1789
  } else {
1697
1790
  result[key] = serialize.cube(value);
@@ -1709,21 +1802,21 @@ var flatURLParams = (data, serializes) => {
1709
1802
  if (!serialize) continue;
1710
1803
  params.append(
1711
1804
  key,
1712
- (0, import_lodash_es6.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)
1713
1806
  );
1714
1807
  }
1715
1808
  return params.toString();
1716
1809
  };
1717
1810
 
1718
1811
  // src/style/css.ts
1719
- var import_lodash_es7 = require("lodash-es");
1812
+ var import_lodash_es8 = require("lodash-es");
1720
1813
  var hump = /[A-Z]/g;
1721
1814
  var css = (...args) => {
1722
1815
  const list = [];
1723
1816
  for (let i = 0; i < args.length; i++) {
1724
1817
  const data = args[i];
1725
1818
  if (!data) continue;
1726
- if ((0, import_lodash_es7.isString)(data)) {
1819
+ if ((0, import_lodash_es8.isString)(data)) {
1727
1820
  list.push(data);
1728
1821
  } else if (Array.isArray(data)) {
1729
1822
  const result = css(...data);
package/dist/index.d.ts CHANGED
@@ -6,8 +6,9 @@ export { deepWeakEqual } from './compare/weak-equal';
6
6
  export { hash8json } from './convert/json';
7
7
  export { hash8object } from './convert/object';
8
8
  export { hash8strings } from './convert/strings';
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, 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';
10
10
  export { type DesensDecrypt, type DesensEncrypt, desensEncrypt, desensDecrypt, desensReplace } from './desens';
11
+ export { type Dic, default as DicRollup } from './dic';
11
12
  export { getEncoding } from './encoding';
12
13
  export { inputRegex } from './input-regex';
13
14
  export { isClass } from './is/class';
package/dist/index.js CHANGED
@@ -6,8 +6,9 @@ import { deepWeakEqual } from "./compare/weak-equal";
6
6
  import { hash8json } from "./convert/json";
7
7
  import { hash8object } from "./convert/object";
8
8
  import { hash8strings } from "./convert/strings";
9
- import { 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
+ import { 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";
10
10
  import { desensEncrypt, desensDecrypt, desensReplace } from "./desens";
11
+ import { default as default2 } from "./dic";
11
12
  import { getEncoding } from "./encoding";
12
13
  import { inputRegex } from "./input-regex";
13
14
  import { isClass } from "./is/class";
@@ -19,8 +20,8 @@ import { MemoryBasic } from "./memory/basic";
19
20
  import { MemoryList } from "./memory/list";
20
21
  import { MemoryPower } from "./memory/power";
21
22
  import { MemorySimple } from "./memory/simple";
22
- import { default as default2 } from "./neo4j-anchors";
23
- import { default as default3 } from "./neo4j";
23
+ import { default as default3 } from "./neo4j-anchors";
24
+ import { default as default4 } from "./neo4j";
24
25
  import { once } from "./once";
25
26
  import { parseNum } from "./parse/num";
26
27
  import { deconPowersSum } from "./power/decon";
@@ -28,29 +29,30 @@ import { rotateAngle } from "./rotate/angle";
28
29
  import { rotateRad } from "./rotate/rad";
29
30
  import { cubeURLParams, flatURLParams } from "./serialize/url-params";
30
31
  import { css } from "./style/css";
31
- import { default as default4 } from "./subscriber";
32
+ import { default as default5 } from "./subscriber";
32
33
  import { FlexTable } from "./table/flex";
33
34
  import { Union } from "./union";
34
35
  import { joinPaths } from "./url/join";
35
36
  import { connectURLParams } from "./url/params";
36
37
  import { wait } from "./wait";
37
38
  export {
39
+ AggUnit,
38
40
  Cron,
39
- DayLastValue,
40
- DigitsValue,
41
+ DayLastUnit,
42
+ default2 as DicRollup,
41
43
  FlexTable,
42
- InvalidValue,
44
+ InvalidUnit,
43
45
  MemoryBasic,
44
46
  MemoryList,
45
47
  MemoryPower,
46
48
  MemorySimple,
47
- default3 as Neo4j,
48
- default2 as Neo4jAhchors,
49
- RangeValue,
50
- default4 as Subscriber,
49
+ default4 as Neo4j,
50
+ default3 as Neo4jAhchors,
51
+ RangeUnit,
52
+ default5 as Subscriber,
51
53
  Union,
52
- WeekLastValue,
53
- WildcardValue,
54
+ WeekLastUnit,
55
+ WildcardUnit,
54
56
  calc,
55
57
  clamp,
56
58
  classnames,
@@ -82,17 +84,17 @@ export {
82
84
  hash8object,
83
85
  hash8strings,
84
86
  inputRegex,
87
+ isAggUnit,
85
88
  isCalc,
86
89
  isClass,
87
- isDayLastValue,
88
- isDigitsValue,
90
+ isDayLastUnit,
89
91
  isEmpty,
90
- isInvalidValue,
92
+ isInvalidUnit,
91
93
  isKey,
92
94
  isNull,
93
- isRangeValue,
94
- isWeekLastValue,
95
- isWildcardValue,
95
+ isRangeUnit,
96
+ isWeekLastUnit,
97
+ isWildcardUnit,
96
98
  joinPaths,
97
99
  loadImage,
98
100
  once,
package/dist/parse/num.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { isNumber } from "lodash-es";
2
- const pow = Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));
2
+ const { MAX_SAFE_INTEGER, NaN } = Number;
3
+ const pow = Math.floor(Math.log10(MAX_SAFE_INTEGER));
3
4
  const re_num = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
4
5
  const parseNum = (num) => {
5
6
  if (isNumber(num) || typeof num === "bigint") return num;
6
7
  const match = num.match(re_num);
7
- if (!match) return Number.NaN;
8
+ if (!match) return NaN;
8
9
  const [, valueSymbol, integer, bigint, decimal, powSymbol, powValue] = match;
9
10
  if (bigint === "n") return BigInt(valueSymbol + integer);
10
11
  const powSize = integer.length - 1 + (powValue ? powSymbol === "-" ? -powValue : +powValue : 0);
11
- if (powSize < pow || powSize === pow && +integer.slice(0, -1) < Number.MAX_SAFE_INTEGER / 10) return +num;
12
+ if (powSize < pow || powSize === pow && +integer.slice(0, -1) < MAX_SAFE_INTEGER / 10) return +num;
12
13
  try {
13
14
  const bigValue = BigInt(integer.slice(0, powSize + 1).padEnd(powSize + 1, "0"));
14
15
  let smallValue;
@@ -23,7 +24,7 @@ const parseNum = (num) => {
23
24
  const value = bigValue + smallValue;
24
25
  return valueSymbol === "-" ? value * BigInt(-1) : value;
25
26
  } catch {
26
- return Number.NaN;
27
+ return NaN;
27
28
  }
28
29
  };
29
30
  export {