ts-type-predicates
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.5](https://github.com/bluelovers/ws-ts-type/compare/ts-type-predicates@1.0.4...ts-type-predicates@1.0.5) (2021-07-27) | ||
### ✨ Features | ||
* add `ignoreExpression` ([47d3b6b](https://github.com/bluelovers/ws-ts-type/commit/47d3b6bda19a27c5c23cf7ea6f7674358bb8123c)) | ||
## [1.0.4](https://github.com/bluelovers/ws-ts-type/compare/ts-type-predicates@1.0.3...ts-type-predicates@1.0.4) (2021-07-22) | ||
@@ -8,0 +19,0 @@ |
@@ -7,4 +7,4 @@ /** | ||
*/ | ||
export declare function typePredicates<T, P = any>(actual: T | P, expression?: boolean | ((actual: T | P) => any), message?: string): asserts actual is T; | ||
export declare function typePredicates<T, P = any>(actual: T | P, expression?: boolean | ((actual: T | P) => any), message?: string, ignoreExpression?: boolean): asserts actual is T; | ||
export declare function typeNarrowed<T, P = any>(actual: T | P, expression?: boolean | ((actual: T | P) => any), message?: string): actual is T; | ||
export default typePredicates; |
@@ -11,3 +11,3 @@ "use strict"; | ||
*/ | ||
function typePredicates(actual, expression = true, message) { | ||
function typePredicates(actual, expression = true, message, ignoreExpression) { | ||
expression !== null && expression !== void 0 ? expression : (expression = true); | ||
@@ -17,3 +17,3 @@ if (typeof expression === 'function') { | ||
} | ||
if (expression !== true) { | ||
if (expression !== true && ignoreExpression !== true) { | ||
throw new assert_1.AssertionError({ | ||
@@ -20,0 +20,0 @@ message: message !== null && message !== void 0 ? message : `actual ${actual} not as expected`, |
{ | ||
"name": "ts-type-predicates", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "use asserts for make type predicates work", | ||
@@ -31,3 +31,3 @@ "homepage": "https://github.com/bluelovers/ws-ts-type/tree/master/packages/ts-type-predicates#readme", | ||
}, | ||
"gitHead": "ec7a763fd85c1e284d5276113109a7ee43f93b91" | ||
"gitHead": "3db58925a73a0d5555d4f8dd95f41e93e7855f5b" | ||
} |
Sorry, the diff of this file is not supported yet
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
7072