kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/657/head
rodzic
5fbad5f57b
commit
a1ebc9ddbf
|
@ -1,15 +1,15 @@
|
||||||
import is from '@sindresorhus/is'
|
import { isError } from '@sindresorhus/is'
|
||||||
|
|
||||||
function assertImpl(value: unknown, message?: string | Error): asserts value {
|
function assertImpl(value: unknown, message?: string | Error): asserts value {
|
||||||
if (value) {
|
if (value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.error(message)) {
|
if (!message) {
|
||||||
throw message
|
throw new Error('Assertion failed')
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(message ?? 'Assertion failed')
|
throw isError(message) ? message : new Error(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Ładowanie…
Reference in New Issue