This npm library provides a TypeScript implementation for handling results and errors in a functional style.
To install the library, run:
npm install rdnt
Here's a quick example to get you started:
import { Result, Err, unwrap } from 'rdnt';
const result = Result(42);
const error = Err({ message: 'Error occurred' });
try {
const value = unwrap(result);
console.log(value); // Outputs: 42
} catch (e) {
console.error(e);
}
Contributions are welcome! Please feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.