14 lines
235 B
Plaintext
14 lines
235 B
Plaintext
function isError(value) {
|
|
if (value == null) {
|
|
return false;
|
|
}
|
|
if (value instanceof Error) {
|
|
return true;
|
|
}
|
|
const { name } = value;
|
|
return typeof name === "string" && name.endsWith("Error");
|
|
}
|
|
export {
|
|
isError
|
|
};
|