Comparing version 2.0.0-4 to 2.0.0-5
@@ -29,2 +29,3 @@ declare const INTERNAL: unique symbol; | ||
static readonly isOneOf: typeof isOneOf; | ||
static readonly isOneOfObj: typeof isOneOfObj; | ||
static readonly match: typeof match; | ||
@@ -53,2 +54,3 @@ static readonly matchObj: typeof matchObj; | ||
declare function isOneOf(error: unknown, types: ErreurTypeAny[]): error is Erreur; | ||
declare function isOneOfObj(error: unknown, types: TypesBase): error is Erreur; | ||
declare function match<Data>(error: unknown, type: ErreurType<Data>): Data | null; | ||
@@ -55,0 +57,0 @@ declare type TypesBase = Record<string, ErreurTypeAny>; |
@@ -68,2 +68,3 @@ var __defProp = Object.defineProperty; | ||
Erreur.isOneOf = isOneOf; | ||
Erreur.isOneOfObj = isOneOfObj; | ||
Erreur.match = match; | ||
@@ -124,2 +125,8 @@ Erreur.matchObj = matchObj; | ||
} | ||
function isOneOfObj(error, types) { | ||
if (error instanceof Erreur) { | ||
return Object.values(types).some((type) => error[INTERNAL].type[INTERNAL] === type[INTERNAL]); | ||
} | ||
return false; | ||
} | ||
function match(error, type) { | ||
@@ -126,0 +133,0 @@ if (error instanceof Erreur) { |
{ | ||
"name": "erreur", | ||
"version": "2.0.0-4", | ||
"version": "2.0.0-5", | ||
"description": "Type safe custom errors", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
17644
402