@tb-dev/utils 1.7.7 → 1.8.1

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/panic.cjs CHANGED
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function panic(message) {
4
- throw new Error(message);
3
+ function panic(...args) {
4
+ throw new Error(args[0]);
5
5
  }
6
- function todo(message = "not yet implemented") {
6
+ function todo(...args) {
7
+ const message = typeof args[0] === "string" ? args[0] : "todo";
7
8
  panic(message);
8
9
  }
9
- function unimplemented(message = "not implemented") {
10
+ function unimplemented(...args) {
11
+ const message = typeof args[0] === "string" ? args[0] : "not implemented";
10
12
  panic(message);
11
13
  }
12
- function unreachable(message = "unreachable") {
14
+ function unreachable(...args) {
15
+ const message = typeof args[0] === "string" ? args[0] : "unreachable";
13
16
  panic(message);
14
17
  }
15
18
  exports.panic = panic;
package/dist/panic.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare function panic(message?: string): never;
2
- export declare function todo(message?: string): never;
3
- export declare function unimplemented(message?: string): never;
4
- export declare function unreachable(message?: string): never;
1
+ export declare function panic(...args: any[]): never;
2
+ export declare function todo(...args: any[]): never;
3
+ export declare function unimplemented(...args: any[]): never;
4
+ export declare function unreachable(...args: any[]): never;
package/dist/panic.js CHANGED
@@ -1,13 +1,16 @@
1
- function panic(message) {
2
- throw new Error(message);
1
+ function panic(...args) {
2
+ throw new Error(args[0]);
3
3
  }
4
- function todo(message = "not yet implemented") {
4
+ function todo(...args) {
5
+ const message = typeof args[0] === "string" ? args[0] : "todo";
5
6
  panic(message);
6
7
  }
7
- function unimplemented(message = "not implemented") {
8
+ function unimplemented(...args) {
9
+ const message = typeof args[0] === "string" ? args[0] : "not implemented";
8
10
  panic(message);
9
11
  }
10
- function unreachable(message = "unreachable") {
12
+ function unreachable(...args) {
13
+ const message = typeof args[0] === "string" ? args[0] : "unreachable";
11
14
  panic(message);
12
15
  }
13
16
  export {
package/dist/string.cjs CHANGED
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const array = require("./array.cjs");
4
4
  function splitWhitespace(value) {
5
- if (!value)
6
- return [];
5
+ if (!value) return [];
7
6
  if (Array.isArray(value)) {
8
7
  const array2 = value.map((i) => splitWhitespace(i));
9
8
  return array2.flat(Number.POSITIVE_INFINITY);
package/dist/string.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { trimArray } from "./array.js";
2
2
  function splitWhitespace(value) {
3
- if (!value)
4
- return [];
3
+ if (!value) return [];
5
4
  if (Array.isArray(value)) {
6
5
  const array = value.map((i) => splitWhitespace(i));
7
6
  return array.flat(Number.POSITIVE_INFINITY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/utils",
3
- "version": "1.7.7",
3
+ "version": "1.8.1",
4
4
  "description": "TypeScript utils",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,20 +27,20 @@
27
27
  "*.{?(c|m)@(j|t)s,vue}": "pnpm run lint"
28
28
  },
29
29
  "dependencies": {
30
- "@tb-dev/utility-types": "^1.3.2"
30
+ "@tb-dev/utility-types": "^1.3.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@tb-dev/eslint-config": "^3.7.2",
33
+ "@tb-dev/eslint-config": "^3.8.0",
34
34
  "@types/node": "^20.14.2",
35
35
  "eslint": "^8.57.0",
36
36
  "husky": "^9.0.11",
37
- "lint-staged": "^15.2.5",
38
- "prettier": "^3.3.1",
37
+ "lint-staged": "^15.2.7",
38
+ "prettier": "^3.3.2",
39
39
  "tslib": "^2.6.3",
40
40
  "typedoc": "^0.25.13",
41
- "typedoc-plugin-mdn-links": "^3.1.29",
41
+ "typedoc-plugin-mdn-links": "^3.1.30",
42
42
  "typescript": "^5.4.5",
43
- "vite": "^5.2.13",
43
+ "vite": "^5.3.1",
44
44
  "vite-plugin-dts": "^3.9.1"
45
45
  },
46
46
  "files": [