{"_id":"@embers-of-the-fire/resultjs","name":"@embers-of-the-fire/resultjs","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@embers-of-the-fire/resultjs","version":"1.0.0","description":"elegant result lib","main":"./dist/lib.js","typings":"./dist/lib.d.ts","scripts":{"test":"jest","build":"tsc","prepare":"npm run build","prepublishOnly":"npm run test"},"keywords":["Result","Error","Monad","Function","FP","TypeScript"],"author":{"name":"Embers-of-the-Fire"},"license":"MIT OR Apache-2.0","dependencies":{"typescript":"^5.1.6"},"devDependencies":{"@types/jest":"^29.5.4","jest":"^29.6.3","ts-jest":"^29.1.1","ts-node":"^10.9.1"},"gitHead":"712e272d80f796eee581b8561ce7ab1f4b3b94ea","_id":"@embers-of-the-fire/resultjs@1.0.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-p12zjJv8xA/sBYkXgFf7jB8yNqM0o9tJhZ85pOZkbW7M2OV1DzFv3kEDqv8thu6H85udhI9d3NP678tXzSiu6w==","shasum":"8e63b90ac7f49be8539dbb96d0b485c5271d4cbe","tarball":"https://registry.npmjs.org/@embers-of-the-fire/resultjs/-/resultjs-1.0.0.tgz","fileCount":4,"unpackedSize":18748,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID+pdOLSnAFM5ooH1iYaK2ZUShhDtKjaabbiJCWaKoGYAiEA/gmMaIGxawDZSm3LXfmrgicE3dSSF/JBST2PT2AtEi8="}]},"_npmUser":{"name":"embers-of-the-fire","email":"stellarishs@163.com"},"directories":{},"maintainers":[{"name":"embers-of-the-fire","email":"stellarishs@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resultjs_1.0.0_1692929906027_0.37088018597187644"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-25T02:18:25.919Z","1.0.0":"2023-08-25T02:18:26.215Z","modified":"2023-08-25T02:18:26.489Z"},"maintainers":[{"name":"embers-of-the-fire","email":"stellarishs@163.com"}],"description":"elegant result lib","keywords":["Result","Error","Monad","Function","FP","TypeScript"],"author":{"name":"Embers-of-the-Fire"},"license":"MIT OR Apache-2.0","readme":"# Result.js\r\n\r\nA TypeScript/Javascript Exception Handling Library.\r\n\r\n## Introduction\r\n\r\n### What is Result.js\r\n\r\nResult.ts is a exception handling library for TypeScript/Javascript, aiming for elegant result wrapping, parsing and handling, inspired by [Rust][]'s [`std::result::Result`][] enumeration.\r\n\r\n[Rust]: https://www.rust-lang.org\r\n[`std::result::Result`]: https://doc.rust-lang.org/std/result/enum.Result.html\r\n\r\n### How to install\r\n\r\nFirst, make sure that you've already installed [nodejs][].\r\n\r\nThen, in your terminal, run the following command:\r\n\r\n```bash\r\nnpm install --save-dev @embers-of-the-fire/resultjs\r\n```\r\n\r\n[nodejs]: https://nodejs.org/\r\n\r\n### Quick Start\r\n\r\nAfter installing the library, you could use it in your project.\r\n\r\nFirst, import the core structure:\r\n\r\n```ts\r\nimport { Result } from '@embers-of-the-fire/resultjs';\r\n```\r\n\r\nThen, turn your current union object into `Result` object. A `Result<T, E>` object views `T` as success value and `E` as failure value. You could construct a result by calling:\r\n\r\n```ts\r\nlet success: Result<number, string> = Result.Ok(1); // This creates a success value, aka `Ok(_)`.\r\nlet failure: Result<number, string> = Result.Err('error'); // This creates a failure value, aka `Err(_)`.\r\n```\r\n\r\nFor more information about the FP API, see [the documentation][].\r\n\r\n[the documentation]: https://embers-of-the-fire.github.io/result-js/\r\n\r\n## License\r\n\r\nThis repository is licensed under the [MIT License][] and the [Apache License v2.0][].\r\n\r\n[MIT License]: ./LICENSE-MIT\r\n[Apache License v2.0]: ./LICENSE-APACHE","readmeFilename":"README.md"}