@battis/typescript-tricks 0.7.0 → 0.7.2

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,17 @@
1
1
  # @battis/typescript-tricks
2
2
 
3
+ ## 0.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 66ec81d: CoerceError without losing stack
8
+
9
+ ## 0.7.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 1a87af4: npmignore fixed
14
+
3
15
  ## 0.7.0
4
16
 
5
17
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Coerce = void 0;
4
- function FailedCoercion(u) {
3
+ exports.Coerce = Coerce;
4
+ function FailedCoercion() {
5
5
  throw new TypeError('Attempted coercion to a non-matching type');
6
6
  }
7
7
  function Coerce(u, isT, toT = (FailedCoercion)) {
@@ -10,4 +10,3 @@ function Coerce(u, isT, toT = (FailedCoercion)) {
10
10
  }
11
11
  return toT(u);
12
12
  }
13
- exports.Coerce = Coerce;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoerceError = exports.isError = void 0;
3
+ exports.isError = isError;
4
+ exports.CoerceError = CoerceError;
4
5
  const Coerce_js_1 = require("./Coerce.js");
5
6
  function isError(error) {
6
7
  return (typeof error === 'object' &&
@@ -10,8 +11,6 @@ function isError(error) {
10
11
  typeof error.name === 'string' &&
11
12
  typeof error.message === 'string');
12
13
  }
13
- exports.isError = isError;
14
14
  function CoerceError(error) {
15
- return (0, Coerce_js_1.Coerce)(error, isError, (e) => new Error(String(e)));
15
+ return (0, Coerce_js_1.Coerce)(error, isError, (e) => e);
16
16
  }
17
- exports.CoerceError = CoerceError;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instanceOf = exports.filterByType = exports.isConstructor = void 0;
3
+ exports.instanceOf = exports.isConstructor = void 0;
4
+ exports.filterByType = filterByType;
4
5
  const isConstructor = (value) => {
5
6
  return !!value && !!value.prototype && !!value.prototype.constructor;
6
7
  };
@@ -24,6 +25,5 @@ exports.isConstructor = isConstructor;
24
25
  function filterByType(array, filterType) {
25
26
  return array.filter((e) => e instanceof filterType);
26
27
  }
27
- exports.filterByType = filterByType;
28
28
  /** @deprecated use {@link filterByType} */
29
29
  exports.instanceOf = filterByType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEnumValues = void 0;
3
+ exports.getEnumValues = getEnumValues;
4
4
  /**
5
5
  * @see {@link https://blog.oyam.dev/typescript-enum-values/ How to get an array of enum values in TypeScript}
6
6
  */
@@ -9,4 +9,3 @@ function getEnumValues(enumObject) {
9
9
  .filter((key) => Number.isNaN(Number(key)))
10
10
  .map((key) => enumObject[key]);
11
11
  }
12
- exports.getEnumValues = getEnumValues;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@battis/typescript-tricks",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "A handful of useful types and operators",
5
- "homepage": "https://github.com/battis/typescript-config/tree/main/packages/tricks#readme",
5
+ "homepage": "https://github.com/battis/typescript-config/tree/main/packages/typescript-tricks#readme",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/battis/typescript-config.git",
9
- "directory": "packages/tricks"
9
+ "directory": "packages/typescript-tricks"
10
10
  },
11
11
  "license": "GPL-3.0",
12
12
  "author": {
@@ -16,10 +16,10 @@
16
16
  "main": "./dist/index.js",
17
17
  "types": "./dist/index.d.ts",
18
18
  "devDependencies": {
19
- "@tsconfig/recommended": "^1.0.7",
20
- "del-cli": "^5.1.0",
19
+ "@tsconfig/recommended": "^1.0.8",
20
+ "del-cli": "^6.0.0",
21
21
  "npm-run-all": "^4.1.5",
22
- "typescript": "^4.9.5"
22
+ "typescript": "^5.7.2"
23
23
  },
24
24
  "engines": {
25
25
  "node": "*"