From 19826ab203f9f924d7f4e9bd0bb9ca54ee4b5c79 Mon Sep 17 00:00:00 2001 From: rowan <rowan@kitsu.cafe> Date: Mon, 31 Mar 2025 20:49:12 -0500 Subject: [PATCH] add isSome/isNone; fix more formatting; fix typoes --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6ff355c..1531154 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ const twelve = curriedAdd(4, 4, 4) // 12 ``` ### Option -> Option<T> = Some<T> | None +> Option\<T\> = Some\<T\> | None Represents a value which may not exist. @@ -120,11 +120,26 @@ none.fold((acc, x) => x, 2) // 2 ##### isSome :: Option f => () -> boolean > Option\<T\>.isSome() -> boolean +Returns a boolean based on whether the Option is `Some<T>` + +```js +Some(1).isSome() // true +None.isSome() // false +``` + ##### isNone :: Option f => () -> boolean > Option\<T\>.isNone() -> boolean +Returns a boolean based on whether the Option is `None` + +```js +Some(1).isNone() // false +None.isNone() // true +``` + + ### Result -> Result<T, E> = Ok<T> | Err<E> +> Result<T, E> = Ok\<T\> | Err\<E\> Represents a value which may fail. @@ -225,11 +240,11 @@ err.bimap( ##### isOk :: Result f => () -> boolean > Result\<T, E\>.isOk() -> boolean -Returns a boolean based on whether the Result is `Some<T>` +Returns a boolean based on whether the Result is `Ok<T>` ```js -Ok(1).isSome() // true -Err(1).isSome() // false +Ok(1).isOk() // true +Err(1).isOk() // false ``` ##### isErr :: Result f => () -> boolean