{"id":31425034,"url":"https://github.com/es-shims/error.iserror","last_synced_at":"2025-09-30T04:54:59.274Z","repository":{"id":258185891,"uuid":"873181200","full_name":"es-shims/Error.isError","owner":"es-shims","description":"An ESnext spec-compliant `Error.isError` shim/polyfill/replacement that works as far down as ES3.","archived":false,"fork":false,"pushed_at":"2025-07-24T21:56:46.000Z","size":37,"stargazers_count":2,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-28T04:44:39.303Z","etag":null,"topics":["ecmascript","error","iserror","javascript","polyfill","shim"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/es-shims.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/es5-shim","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2024-10-15T18:23:43.000Z","updated_at":"2025-07-24T21:56:50.000Z","dependencies_parsed_at":"2024-10-17T23:55:03.170Z","dependency_job_id":"76edcfdd-09b0-4d9a-938a-e0795f4663c1","html_url":"https://github.com/es-shims/Error.isError","commit_stats":null,"previous_names":["es-shims/error.iserror"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/es-shims/Error.isError","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FError.isError","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FError.isError/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FError.isError/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FError.isError/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/Error.isError/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FError.isError/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277632369,"owners_count":25850734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecmascript","error","iserror","javascript","polyfill","shim"],"created_at":"2025-09-30T04:54:57.660Z","updated_at":"2025-09-30T04:54:59.266Z","avatar_url":"https://github.com/es-shims.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/es5-shim"],"categories":[],"sub_categories":[],"readme":"# Error.isError \u003csup\u003e[![Version Badge][npm-version-svg]][package-url]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nAn ESnext spec-compliant `Error.isError` shim/polyfill/replacement that works as far down as ES3.\n\nThis package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the proposed [spec](https://tc39.es/proposal-is-error/).\n\n## Getting started\n\n```sh\nnpm install --save error.iserror\n```\n\n## Usage/Examples\n\n```js\nconst isError = require('error.iserror');\nvar assert = require('assert');\n\nassert.equal(isError(undefined), false);\nassert.equal(isError(null), false);\nassert.equal(isError({}), false);\nassert.equal(isError([]), false);\nassert.equal(isError(Error), false);\nassert.equal(isError({ __proto__: Error.prototype, constructor: Error }), false);\n\nassert.equal(isError(new Error()), true);\nassert.equal(isError(new EvalError()), true);\nassert.equal(isError(new RangeError()), true);\nassert.equal(isError(new ReferenceError()), true);\nassert.equal(isError(new SyntaxError()), true);\nassert.equal(isError(new TypeError()), true);\nassert.equal(isError(new URIError()), true);\n\nif (typeof AggregateError === 'function') {\n    assert.equal(isError(new AggregateError([])), true);\n}\nif (typeof SuppressedError === 'function') {\n    assert.equal(isError(new SuppressedError()), true);\n}\n\n// note: engines that have `Symbol.toStringTag`, and lack structuredClone, and lack other brand-checking\n// mechanisms, are only capable of brand-checking Error objects when they lack a `Symbol.toStringTag` property in their\n// prototype chain. An object with it will give the wrong answer.\n// This affects node 6 - 9, Chrome 49 - 97, Safari 10 - 14, Edge 15 - 18\n\nassert.equal(isError({ __proto__: Error.prototype, constructor: Error, [Symbol.toStringTag]: 'Error' }), false);\n\nconst err = Object.assign(new Error(), { [Symbol.toStringTag]: 'Non-Error' });\nObject.setPrototypeOf(err, null);\nassert.equal(isError(err), true);\n\n\n// note: node \u003c v24.3 has an `Error.isError` that does not work correctly with DOMException objects\nassert.equal(isError(new DOMException()), true);\n```\n\n```js\nvar shimIsError = require('error.iserror/shim');\nconst getPolyfill = require('error.iserror/polyfill');\nvar assert = require('assert');\n/* when Error.isError is not present */\ndelete Error.isError;\nvar shimmed = shimIsError();\n\nassert.equal(shimmed, getPolyfill());\nassert.deepEqual(Error.isError(new Error()), isError(new Error()));\n```\n\n```js\nvar shimIsError = require('error.iserror/shim');\nvar assert = require('assert');\n/* when Error.isError is present */\nvar shimmed = shimIsError();\n\nassert.equal(shimmed, Error.isError);\nassert.deepEqual(Error.isError(new Error()), isError(new Error()));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/error.iserror\n[npm-version-svg]: https://versionbadg.es/es-shims/Error.isError.svg\n[deps-svg]: https://david-dm.org/es-shims/Error.isError.svg\n[deps-url]: https://david-dm.org/es-shims/Error.isError\n[dev-deps-svg]: https://david-dm.org/es-shims/Error.isError/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/Error.isError#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/error.iserror.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/error.iserror.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/error.iserror.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=error.iserror\n[codecov-image]: https://codecov.io/gh/es-shims/Error.isError/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/Error.isError/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Error.isError\n[actions-url]: https://github.com/es-shims/Error.isError/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Ferror.iserror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Ferror.iserror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Ferror.iserror/lists"}