@tb-dev/utils 1.5.2 → 1.6.0

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 CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const regex = require("./regex.cjs");
4
4
  const array = require("./array.cjs");
5
+ const panic = require("./panic.cjs");
5
6
  function isEmpty(value) {
6
7
  if (isNullish(value)) {
7
8
  return true;
@@ -30,6 +31,10 @@ exports.splitWhitespace = array.splitWhitespace;
30
31
  exports.toArray = array.toArray;
31
32
  exports.trimArray = array.trimArray;
32
33
  exports.upsert = array.upsert;
34
+ exports.panic = panic.panic;
35
+ exports.todo = panic.todo;
36
+ exports.unimplemented = panic.unimplemented;
37
+ exports.unreachable = panic.unreachable;
33
38
  exports.isEmpty = isEmpty;
34
39
  exports.isNullish = isNullish;
35
40
  exports.noop = noop;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from './array';
2
+ export * from './panic';
2
3
  export * from './regex';
3
4
  /**
4
- * Check if a value is empty.
5
+ * Checks if a value is empty.
5
6
  *
6
7
  * Arrays and strings are considered empty if they have a length of 0.
7
8
  * Map and Sets are considered empty if they have a size of 0.
@@ -12,8 +13,5 @@ export * from './regex';
12
13
  export declare function isEmpty(value?: unknown): boolean;
13
14
  export declare function isNullish(value: unknown): value is null | undefined;
14
15
  export declare const noop: () => void;
15
- /**
16
- * Add the pixel unit to a value.
17
- * If the value is a string, it is returned unchanged.
18
- */
16
+ /** Adds the pixel unit to a value. */
19
17
  export declare function toPixel(value: string | number): string;
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { regex } from "./regex.js";
2
2
  import { splitWhitespace, toArray, trimArray, upsert } from "./array.js";
3
+ import { panic, todo, unimplemented, unreachable } from "./panic.js";
3
4
  function isEmpty(value) {
4
5
  if (isNullish(value)) {
5
6
  return true;
@@ -27,10 +28,14 @@ export {
27
28
  isEmpty,
28
29
  isNullish,
29
30
  noop,
31
+ panic,
30
32
  regex,
31
33
  splitWhitespace,
32
34
  toArray,
33
35
  toPixel,
36
+ todo,
34
37
  trimArray,
38
+ unimplemented,
39
+ unreachable,
35
40
  upsert
36
41
  };
package/dist/panic.cjs ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function panic(message) {
4
+ throw new Error(message);
5
+ }
6
+ function todo(message = "not yet implemented") {
7
+ panic(message);
8
+ }
9
+ function unimplemented(message = "not implemented") {
10
+ panic(message);
11
+ }
12
+ function unreachable(message = "unreachable") {
13
+ panic(message);
14
+ }
15
+ exports.panic = panic;
16
+ exports.todo = todo;
17
+ exports.unimplemented = unimplemented;
18
+ exports.unreachable = unreachable;
@@ -0,0 +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;
package/dist/panic.js ADDED
@@ -0,0 +1,18 @@
1
+ function panic(message) {
2
+ throw new Error(message);
3
+ }
4
+ function todo(message = "not yet implemented") {
5
+ panic(message);
6
+ }
7
+ function unimplemented(message = "not implemented") {
8
+ panic(message);
9
+ }
10
+ function unreachable(message = "unreachable") {
11
+ panic(message);
12
+ }
13
+ export {
14
+ panic,
15
+ todo,
16
+ unimplemented,
17
+ unreachable
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/utils",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "TypeScript utils",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,8 +30,8 @@
30
30
  "@tb-dev/utility-types": "^1.2.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@tb-dev/eslint-config": "^3.4.0",
34
- "@types/node": "^20.12.7",
33
+ "@tb-dev/eslint-config": "^3.4.2",
34
+ "@types/node": "^20.12.8",
35
35
  "eslint": "^8.57.0",
36
36
  "husky": "^9.0.11",
37
37
  "lint-staged": "^15.2.2",
@@ -40,7 +40,7 @@
40
40
  "typedoc": "^0.25.13",
41
41
  "typedoc-plugin-mdn-links": "^3.1.23",
42
42
  "typescript": "^5.4.5",
43
- "vite": "^5.2.10",
43
+ "vite": "^5.2.11",
44
44
  "vite-plugin-dts": "^3.9.0"
45
45
  },
46
46
  "files": [
@@ -60,6 +60,11 @@
60
60
  "import": "./dist/array.js",
61
61
  "require": "./dist/array.cjs"
62
62
  },
63
+ "./panic": {
64
+ "types": "./dist/panic.d.ts",
65
+ "import": "./dist/panic.js",
66
+ "require": "./dist/panic.cjs"
67
+ },
63
68
  "./regex": {
64
69
  "types": "./dist/regex.d.ts",
65
70
  "import": "./dist/regex.js",