Skip to content

Commit

Permalink
Fix typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswrks committed Mar 1, 2024
1 parent 88b0ce3 commit 4cd4e47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type SafeMessageFromOptions = {
expectedCauses?: ExpectedCause[];
default: string;
};
export type ThrownByExpectecCauseOptions = {
export type ThrownByExpectedCauseOptions = {
expectedCauses: ExpectedCause[];
};
type ExpectedCause = string | RegExp;
Expand Down Expand Up @@ -75,12 +75,12 @@ export const safeMessageFrom = (thrown: unknown, options: SafeMessageFromOptions
* Checks if thrown by an expected cause.
*
* @param thrown Something thrown and caught by this utility’s caller.
* @param options `{ expectedCauses }` required; {@see ThrownByExpectecCauseOptions}.
* @param options `{ expectedCauses }` required; {@see ThrownByExpectedCauseOptions}.
*
* @returns True if thrown by an expected cause.
*/
export const thrownByExpectedCause = (thrown: unknown, options: ThrownByExpectecCauseOptions): boolean => {
const opts = $obj.defaults({}, options || {}, { expectedCauses: [] }) as Required<ThrownByExpectecCauseOptions>;
export const thrownByExpectedCause = (thrown: unknown, options: ThrownByExpectedCauseOptions): boolean => {
const opts = $obj.defaults({}, options || {}, { expectedCauses: [] }) as Required<ThrownByExpectedCauseOptions>;

let error: unknown = thrown; // Initialize.
while (opts.expectedCauses.length && $is.error(error) && $is.errorCause(error.cause)) {
Expand Down

0 comments on commit 4cd4e47

Please sign in to comment.