@halospv3/hce.shared-config
Version:
Automate commit message quality, changelogs, and CI/CD releases. Its `main` entry point is a Semantic Release config. Functions and classes are exposed for customization. An ESLint config, a Commitlint config, and addl. resources for .NET projects are als
18 lines (17 loc) • 755 B
JavaScript
import { isNativeError } from "node:util/types";
//#region src/utils/isError.ts
/** @import 'typescript/lib/lib.esnext.error.d.ts' */
/**
* Compatibility wrapper for ES2026 (Node.js 25)
* {@link Error.isError Error.isError}
* with failover to the deprecated {@link isNativeError utils.types.isNativeError}.
* @param error A parameter which may be an Error.
* @returns `true` if {@link error} is derived from or is sufficiently similar to {@link Error}. Else, `false`.
* Note: DOMExceptions will result in `false`
*/
function isError(error) {
return "isError" in Error && typeof Error.isError === "function" && Error.isError.length > 0 ? Error.isError(error) : isNativeError(error);
}
//#endregion
export { isError };
//# sourceMappingURL=isError.mjs.map