This module allows you to remove null
and undefined
from your projects with the help of ES6 Symbols and helper methods. Inspired by Rust's Option
, Result
enums.
The standard practice of returning null
or undefined
when no other value can be returned means that there is no simple way to express the difference between a function that has returned "nothing" and a null
return type. There are also no easy ways to handle errors in a functional pattern. Rust's implementation of Option
and Result
guarantees correctness by expressly forcing correct result-handling practices.
This module provides a minimal, fast and simple way to create expressive functions and perform better pattern matching on resulting values! 🚀
// Result
import { Result, Ok, Err } from "https://deno.land/x/optionals@v2.0.2`/mod.ts";
// Option
import {
Option,
Some,
None,
} from "https://deno.land/x/optionals@v2.0.2/mod.ts";
Please find further documentation on the doc page!