{"_id":"@codecompose/throws","name":"@codecompose/throws","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@codecompose/throws","version":"1.0.0","description":"A Typescript assertion that only throws on null and undefined","type":"module","main":"dist/index.cjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"repository":{"type":"git","url":"git+https://github.com/0x80/throws.git"},"keywords":["typescript","assert","invariant","null","undefined","throw"],"author":{"name":"Thijs Koerselman"},"license":"MIT","bugs":{"url":"https://github.com/0x80/throws/issues"},"homepage":"https://github.com/0x80/throws#readme","devDependencies":{"@codecompose/typescript-config":"^1.0.5","prettier":"^3.3.3","prettier-plugin-jsdoc":"^1.3.0","tsup":"^8.3.0","typescript":"^5.6.2"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","test":"echo \"Error: no test specified\" && exit 1"},"_id":"@codecompose/throws@1.0.0","_integrity":"sha512-Pusb6E/2e0/34YsVtzgooSpcaB1rkUATHuKkep8S//RS3QmdEkStdWf4/hOmDxPcisjsixGFSUGM2gLOdIB6ag==","_resolved":"/private/var/folders/tt/2t2tbx8d6f7_ph4c54m369jw0000gn/T/47353f4bf22e34f4ecb717bd355f9ba7/codecompose-throws-1.0.0.tgz","_from":"file:codecompose-throws-1.0.0.tgz","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Pusb6E/2e0/34YsVtzgooSpcaB1rkUATHuKkep8S//RS3QmdEkStdWf4/hOmDxPcisjsixGFSUGM2gLOdIB6ag==","shasum":"06e477a9b127a749410c9e01e0a3f891fe6a3854","tarball":"https://registry.npmjs.org/@codecompose/throws/-/throws-1.0.0.tgz","fileCount":12,"unpackedSize":5985,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCX7K4QA/D3nsx6tUe+q9Oaw3zKclh08vlx+XmPcJHQuwIgORQDfX7j69TewYPXuK+NLlv1NnC0rD4cyFjrSQ/g0MI="}]},"_npmUser":{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"},"directories":{},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throws_1.0.0_1727619952129_0.3340807108750421"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-29T14:25:52.034Z","1.0.0":"2024-09-29T14:25:52.326Z","modified":"2024-09-29T14:25:52.631Z"},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"description":"A Typescript assertion that only throws on null and undefined","homepage":"https://github.com/0x80/throws#readme","keywords":["typescript","assert","invariant","null","undefined","throw"],"repository":{"type":"git","url":"git+https://github.com/0x80/throws.git"},"author":{"name":"Thijs Koerselman"},"bugs":{"url":"https://github.com/0x80/throws/issues"},"license":"MIT","readme":"# throws\n\nA Typescript assertion that throws only throws on null and undefined. Typically\nwhen writing code we only want to throw on those conditions. Traditional\n`assert` or `invariant` functions throw on all falsy values, and can easily trip\nyou up when you accidentally pass in a valid number that is 0.\n\n## Installation\n\n```bash\npnpm add throws\n```\n\n... or the equivalent for your package manager.\n\n## Usage\n\n```typescript\nimport { throws } from \"throws\";\n\nconst valueOrUndefined: number | undefined = 0;\n\nthrows(valueOrUndefined, \"This is a required value\");\n\n/**\n * At this point Typescript will know that valueOrUndefined is not undefined and\n * will allow you to continue writing safe code.\n */\n```\n\n## No Unchecked Indexed Access\n\nIf you are using the recommended strict `noUncheckedIndexedAccess` setting, you\nmight want to check out [get-or-throw](https://github.com/0x80/get-or-throw).\n","readmeFilename":"README.md"}