Skip to content

Commit

Permalink
add raw function as a get alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
manusant committed May 2, 2024
1 parent 271f6da commit 340fe44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "katxupa",
"version": "1.9.5",
"version": "1.9.6",
"description": "Delicious Dish for Typescript and JavaScript projects",
"author": "Manuel Santos <ney.br.santos@gmail.com>",
"license": "MIT",
Expand Down
9 changes: 9 additions & 0 deletions src/optional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ export class Optional<T> {
return this.value!;
}

/**
* The get method is used to retrieve the value inside the Optional object.
*
* @return The value inside the Optional object.
* */
raw(): T | undefined | null {
return this.value;
}

/**
* The orElse method is used to retrieve the value inside the Optional object if it is present,
* or return a default value if the Optional object is empty.
Expand Down

0 comments on commit 340fe44

Please sign in to comment.