From 19826ab203f9f924d7f4e9bd0bb9ca54ee4b5c79 Mon Sep 17 00:00:00 2001 From: rowan 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 = Some | None +> Option\ = Some\ | None Represents a value which may not exist. @@ -120,11 +120,26 @@ none.fold((acc, x) => x, 2) // 2 ##### isSome :: Option f => () -> boolean > Option\.isSome() -> boolean +Returns a boolean based on whether the Option is `Some` + +```js +Some(1).isSome() // true +None.isSome() // false +``` + ##### isNone :: Option f => () -> boolean > Option\.isNone() -> boolean +Returns a boolean based on whether the Option is `None` + +```js +Some(1).isNone() // false +None.isNone() // true +``` + + ### Result -> Result = Ok | Err +> Result = Ok\ | Err\ Represents a value which may fail. @@ -225,11 +240,11 @@ err.bimap( ##### isOk :: Result f => () -> boolean > Result\.isOk() -> boolean -Returns a boolean based on whether the Result is `Some` +Returns a boolean based on whether the Result is `Ok` ```js -Ok(1).isSome() // true -Err(1).isSome() // false +Ok(1).isOk() // true +Err(1).isOk() // false ``` ##### isErr :: Result f => () -> boolean