Comparing version 5.2.2 to 5.3.0
import { CustomError } from './CustomError'; | ||
import { defekt } from './defekt'; | ||
import { isCustomError } from './isCustomError'; | ||
export { CustomError, defekt, isCustomError }; | ||
import { isError } from './isError'; | ||
export { CustomError, defekt, isCustomError, isError }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isCustomError = exports.defekt = void 0; | ||
exports.isError = exports.isCustomError = exports.defekt = void 0; | ||
const defekt_1 = require("./defekt"); | ||
@@ -8,1 +8,3 @@ Object.defineProperty(exports, "defekt", { enumerable: true, get: function () { return defekt_1.defekt; } }); | ||
Object.defineProperty(exports, "isCustomError", { enumerable: true, get: function () { return isCustomError_1.isCustomError; } }); | ||
const isError_1 = require("./isError"); | ||
Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return isError_1.isError; } }); |
@@ -5,8 +5,8 @@ "use strict"; | ||
const isCustomError = function (ex) { | ||
return typeof ex === 'object' && | ||
return (typeof ex === 'object' && | ||
ex !== null && | ||
'message' in ex && typeof ex.message === 'string' && | ||
'name' in ex && typeof ex.name === 'string' && | ||
'code' in ex && typeof ex.code === 'string' && | ||
'message' in ex && typeof ex.message === 'string'; | ||
'code' in ex && typeof ex.code === 'string'); | ||
}; | ||
exports.isCustomError = isCustomError; |
@@ -0,1 +1,8 @@ | ||
# [5.3.0](https://github.com/thenativeweb/defekt/compare/5.2.2...5.3.0) (2020-11-26) | ||
### Features | ||
* Add isError function. ([#221](https://github.com/thenativeweb/defekt/issues/221)) ([dfb3f4c](https://github.com/thenativeweb/defekt/commit/dfb3f4c281976ac7c41785d1ee46e080653e243e)) | ||
## [5.2.2](https://github.com/thenativeweb/defekt/compare/5.2.1...5.2.2) (2020-11-03) | ||
@@ -2,0 +9,0 @@ |
import { CustomError } from './CustomError'; | ||
import { defekt } from './defekt'; | ||
import { isCustomError } from './isCustomError'; | ||
import { isError } from './isError'; | ||
@@ -8,3 +9,4 @@ export { | ||
defekt, | ||
isCustomError | ||
isCustomError, | ||
isError | ||
}; |
import { CustomError } from './CustomError'; | ||
const isCustomError = function (ex: any): ex is CustomError { | ||
return typeof ex === 'object' && | ||
ex !== null && | ||
'name' in ex && typeof ex.name === 'string' && | ||
'code' in ex && typeof ex.code === 'string' && | ||
'message' in ex && typeof ex.message === 'string'; | ||
return ( | ||
typeof ex === 'object' && | ||
ex !== null && | ||
'message' in ex && typeof ex.message === 'string' && | ||
'name' in ex && typeof ex.name === 'string' && | ||
'code' in ex && typeof ex.code === 'string' | ||
); | ||
}; | ||
export { isCustomError }; |
{ | ||
"name": "defekt", | ||
"version": "5.2.2", | ||
"version": "5.3.0", | ||
"description": "defekt is custom errors made simple.", | ||
@@ -30,4 +30,4 @@ "contributors": [ | ||
"assertthat": "5.2.1", | ||
"roboter": "11.5.1", | ||
"semantic-release-configuration": "1.0.23" | ||
"roboter": "11.5.13", | ||
"semantic-release-configuration": "1.0.28" | ||
}, | ||
@@ -34,0 +34,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16162
25
207