{"_id":"is-network-error","_rev":"5-faee71096ad223db46bb4ccf12a10160","name":"is-network-error","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"is-network-error","version":"1.0.0","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"757d7af42263f18f616626e63af12abb19002bbc","tarball":"https://registry.npmjs.org/is-network-error/-/is-network-error-1.0.0.tgz","fileCount":5,"integrity":"sha512-P3fxi10Aji2FZmHTrMPSNFbNC6nnp4U5juPAIjXPHkUNubi4+qK7vvdsaNpAUwXslhYm9oyjEYTxs1xd/+Ph0w==","signatures":[{"sig":"MEUCIFhVjNkxVQGsWk3mbp3D0lwdTU8iEbx2CuqpRdB0VmY9AiEAmRketzkY1t6lHRBY4VM4BQknciW12a5GCg8k8/aeWJQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4460},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"88b46c29fcb69700ab8919be1fd322a234ccbf40","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"9.2.0","description":"Check if a value is a Fetch network error","directories":{},"_nodeVersion":"16.20.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.0.0_1695737709369_0.7316419387319419","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"is-network-error","version":"1.0.1","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.0.1","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"a68061a20387e9144e145571bea693056a370b92","tarball":"https://registry.npmjs.org/is-network-error/-/is-network-error-1.0.1.tgz","fileCount":5,"integrity":"sha512-OwQXkwBJeESyhFw+OumbJVD58BFBJJI5OM5S1+eyrDKlgDZPX2XNT5gXS56GSD3NPbbwUuMlR1Q71SRp5SobuQ==","signatures":[{"sig":"MEYCIQCAnJKyCWGYeN3AviqAEKKG+SRVXDaNDPsVhq4Z0AAMjAIhAMAiQr8AcztT3NCMPORc+3alY33Mkpyu7I2T9M5FzICe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4502},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"bb1d9eaff47c5391bdfa834364ffcafd2c353c1d","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"9.2.0","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"21.2.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.0.1_1704332321723_0.7927684548450891","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"is-network-error","version":"1.1.0","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"d26a760e3770226d11c169052f266a4803d9c997","tarball":"https://registry.npmjs.org/is-network-error/-/is-network-error-1.1.0.tgz","fileCount":5,"integrity":"sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==","signatures":[{"sig":"MEQCICUgiWIKSiIq6jE54UR3a5I7MfjTprrnzrA9hNuSAM/nAiBWYy6R7vcSrArqDxzVs4Q8jhxuNie5B4rXmGVfq83HpQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4537},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"9710d1f0e1f75e6775bbedc909fcb96851031787","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"9.2.0","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"20.11.1","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.1.0_1710851910941_0.9807955355246603","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"is-network-error","version":"1.2.0","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.2.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"ca807bbd4f33967d9954fc7f02bf4176254d71b3","tarball":"https://registry.npmjs.org/is-network-error/-/is-network-error-1.2.0.tgz","fileCount":5,"integrity":"sha512-32jdpRpJo8SeL7zOuBJbMLz/VTw9mDpTvcKzzR8DkXWsJbbE60gdiX8YOd0UAV6b8Skt+CMytzfgVVIRFidn0Q==","signatures":[{"sig":"MEUCIHFW7VUcdarfPXdHHcLrLAlOI9Y5p/hqY8rV4Ge3Zv/DAiEAvf60no8FlaO3zaZJUq4LtzLGL3j4A8/4UKvaJGCX+pM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4941},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"fdec607d793f11a003965078033b19430d4abde0","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"10.9.2","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.2.0_1758040867578_0.35605332681132174","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"is-network-error","version":"1.3.0","description":"Check if a value is a Fetch network error","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"_id":"is-network-error@1.3.0","gitHead":"b119a91971649acc9893efc5aba70be044213b60","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"homepage":"https://github.com/sindresorhus/is-network-error#readme","_nodeVersion":"20.19.5","_npmVersion":"10.9.2","dist":{"integrity":"sha512-6oIwpsgRfnDiyEDLMay/GqCl3HoAtH5+RUKW29gYkL0QA+ipzpDLA16yQs7/RHCSu+BwgbJaOUqa4A99qNVQVw==","shasum":"2ce62cbca444abd506f8a900f39d20b898d37512","tarball":"https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.0.tgz","fileCount":5,"unpackedSize":4999,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD5YlqA9fVgLRt8cCZtSML3BqumqSTcqRr6bAADNLZtcAIhAO3xfp9w9E+Mo1FSVwPO2pMV2a1h5SjdxBumAehAz4TW"}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-network-error_1.3.0_1758213800006_0.10742027568507417"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-26T14:15:09.368Z","modified":"2025-09-18T16:43:20.375Z","1.0.0":"2023-09-26T14:15:09.619Z","1.0.1":"2024-01-04T01:38:41.893Z","1.1.0":"2024-03-19T12:38:31.098Z","1.2.0":"2025-09-16T16:41:07.774Z","1.3.0":"2025-09-18T16:43:20.189Z"},"bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","homepage":"https://github.com/sindresorhus/is-network-error#readme","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"description":"Check if a value is a Fetch network error","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"readme":"# is-network-error\n\n> Check if a value is a [Fetch network error](https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions)\n\nThis can be useful when you want to do something specific when a network error happens without catching other Fetch-related errors.\n\nUnfortunately, Fetch network errors are [not standardized](https://github.com/whatwg/fetch/issues/526) and differ among implementations. This package handles the differences across Node.js, Bun, Deno, and browsers.\n\nFor instance, [`p-retry`](https://github.com/sindresorhus/p-retry) uses this package to retry on network errors.\n\n## Install\n\n```sh\nnpm install is-network-error\n```\n\n## Usage\n\n```js\nimport isNetworkError from 'is-network-error';\n\nasync function getUnicorns() {\n\ttry {\n\t\tconst response = await fetch('unicorns.json');\n\t\treturn await response.json();\n\t} catch (error) {\n\t\tif (isNetworkError(error)) {\n\t\t\treturn localStorage.getItem('…');\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nconsole.log(await getUnicorns());\n```\n\n## API\n\n### `isNetworkError(value: unknown): value is TypeError`\n\nReturns `true` if the given value is a Fetch network error, otherwise `false`.\n\nThis function acts as a type guard, narrowing the type to `TypeError` when it returns `true`.\n","readmeFilename":"readme.md"}