@knime/utils 1.0.5 → 1.0.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @knime/utils
2
2
 
3
+ ## 1.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [15a0549]
8
+ - @knime/styles@1.0.3
9
+
10
+ ## 1.0.7
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [4de967c]
15
+ - @knime/styles@1.0.2
16
+
17
+ ## 1.0.6
18
+
19
+ ### Patch Changes
20
+
21
+ - 20b0b36: Export updateTime utility, type muteConsole
22
+
3
23
  ## 1.0.5
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/utils",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "description": "Internal utility functions and constants shared across @knime packages.",
5
5
  "homepage": "https://knime.github.io/webapps-common/",
6
6
  "license": "GPL 3 and Additional Permissions according to Sec. 7 (SEE the file LICENSE)",
@@ -10,7 +10,7 @@
10
10
  "consola": "3.2.3",
11
11
  "date-fns": "2.30.0",
12
12
  "date-fns-tz": "2.0.0",
13
- "@knime/styles": "1.0.1"
13
+ "@knime/styles": "1.0.3"
14
14
  },
15
15
  "main": "src/index.ts",
16
16
  "module": "src/index.ts",
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import sleep from "./sleep";
7
7
  import { icons, isIconExisting } from "./fileTypeIcons";
8
8
 
9
9
  import updateDate from "./updateDate";
10
+ import updateTime from "./updateTime";
10
11
  import { isAfterMaxDate, isBeforeMinDate } from "./dateMinMaxCheck";
11
12
  import {
12
13
  formatDateString,
@@ -43,20 +44,21 @@ export {
43
44
  caseFormatter,
44
45
  debounce,
45
46
  filters,
46
- truncateString,
47
- getWrappedAroundIndex,
48
- sleep,
49
- icons,
50
- isIconExisting,
51
47
  formatDateString,
52
48
  formatDateTimeString,
53
49
  formatLocalDateTimeString,
54
50
  formatTimeString,
55
- updateDate,
56
- isAfterMaxDate,
57
51
  getLocalTimeZone,
58
- isBeforeMinDate,
59
- numIntegerDigits,
52
+ getWrappedAroundIndex,
60
53
  hotkeys,
54
+ icons,
55
+ isAfterMaxDate,
56
+ isBeforeMinDate,
57
+ isIconExisting,
61
58
  navigatorUtils,
59
+ numIntegerDigits,
60
+ sleep,
61
+ truncateString,
62
+ updateDate,
63
+ updateTime,
62
64
  };
@@ -1,21 +1,25 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
- const methods = ["log", "error", "warn"];
3
+ type ConsoleMethod = "log" | "warn" | "error" | "info";
4
+ const methods: ConsoleMethod[] = ["log", "warn", "error", "info"];
4
5
 
5
6
  /**
6
7
  * Helper function to run code suppressing all console output
7
- * @param {Function} f The function to run. Can be async.
8
- * @returns {any} The original function's return value
8
+ * @param f The function to run. Can be async.
9
+ * @returns The original function's return value
9
10
  */
10
- export default (f) => {
11
- let originals = methods.map((method) => console[method]);
11
+ export default (f: Function) => {
12
+ const originals = methods.map((method) => console[method]);
12
13
  methods.forEach((method) => {
13
14
  console[method] = () => {};
14
15
  });
15
16
 
16
- let originalConsola;
17
+ let originalConsola: typeof consola;
18
+ // @ts-ignore - needs to extend the globalThis namespace
17
19
  if (global.consola) {
20
+ // @ts-ignore
18
21
  originalConsola = global.consola;
22
+ // @ts-ignore
19
23
  global.consola = consola.create({
20
24
  level: -1,
21
25
  });
@@ -26,6 +30,7 @@ export default (f) => {
26
30
  console[method] = originals[i];
27
31
  });
28
32
  if (originalConsola) {
33
+ // @ts-ignore
29
34
  global.consola = originalConsola;
30
35
  }
31
36
  };