Comparing version 2.4.0 to 2.5.0
@@ -5,2 +5,8 @@ # Changelog | ||
## [2.5.0](https://github.com/medikoo/type/compare/v2.4.0...v2.5.0) (2021-03-08) | ||
### Features | ||
- `errorCode` option for `ensure*` utils ([777a1f2](https://github.com/medikoo/type/commit/777a1f2c9fd76defcd24d3a30cce49491947fef7)) | ||
## [2.4.0](https://github.com/medikoo/type/compare/v2.3.0...v2.4.0) (2021-03-08) | ||
@@ -7,0 +13,0 @@ |
@@ -12,3 +12,5 @@ "use strict"; | ||
var ErrorConstructor = (inputOptions && inputOptions.Error) || TypeError; | ||
throw new ErrorConstructor(resolveErrorMessage(defaultMessage, value, inputOptions)); | ||
var error = new ErrorConstructor(resolveErrorMessage(defaultMessage, value, inputOptions)); | ||
if (inputOptions && inputOptions.errorCode) error.code = inputOptions.errorCode; | ||
throw error; | ||
}; |
{ | ||
"name": "type", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Runtime validation and processing of JavaScript types", | ||
@@ -5,0 +5,0 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (https://www.medikoo.com/)", |
@@ -70,2 +70,3 @@ [![*nix build status][nix-build-image]][nix-build-url] | ||
- `%n` - To be replaced with meaninfgul name (to be passed with `name` option) of validated value. Not effective if `name` option is not present | ||
- `errorCode` - Eventual error code to be exposed on `.code` error property | ||
- `name` - Meaningful name for validated value, to be used in error message, assuming it contains `%n` placeholder | ||
@@ -72,0 +73,0 @@ - `Error` - Alternative error constructor to be used (defaults to `TypeError`) |
69466
909
166