Skip to content

Commit

Permalink
💌
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Aug 4, 2024
1 parent 5fbad5f commit a1ebc9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/assert.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import is from '@sindresorhus/is'
import { isError } from '@sindresorhus/is'

function assertImpl(value: unknown, message?: string | Error): asserts value {
if (value) {
return
}

if (is.error(message)) {
throw message
if (!message) {
throw new Error('Assertion failed')
}

throw new Error(message ?? 'Assertion failed')
throw isError(message) ? message : new Error(message)
}

/**
Expand Down

0 comments on commit a1ebc9d

Please sign in to comment.