@storm-stack/types
Version:
⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.
11 lines (10 loc) • 430 B
JavaScript
import { getObjectTag } from "./get-object-tag.mjs";
import { isObject } from "./is-object.mjs";
import { isPlainObject } from "./is-plain-object.mjs";
export const isError = (obj) => {
if (!isObject(obj)) {
return false;
}
const tag = getObjectTag(obj);
return tag === "[object Error]" || tag === "[object DOMException]" || typeof obj?.message === "string" && typeof obj?.name === "string" && !isPlainObject(obj);
};