Skip to content

Commit 630a4f5

Browse files
author
James Toohey
authored
Merge pull request #13 from diogo405/fixes
2 parents e2bec0c + f9ccdb3 commit 630a4f5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/html/Part1Ex1.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<body>
1515

1616
<!--
17-
This project has webpack configured. Run `yarn webpack-dev-server` and navigate to
17+
This project has webpack configured. Run `yarn` to install the dependencies, `yarn webpack-dev-server` to run the server, and then navigate to
1818
http://localhost:8080/src/main/html/Part1Ex1.html to view this page.
1919
2020
tinymce.init is the most important API function of TinyMCE. In its most basic form, you specify a CSS selector for an
@@ -58,4 +58,4 @@
5858

5959
</body>
6060

61-
</html>
61+
</html>

src/main/ts/Part2Ex3Optional.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ e.g.
2929
*/
3030
const parseIntOpt = (s: string): Optional<number> => {
3131
const n = parseInt(s);
32-
return Number.isNaN(n) ? Optional.some(n) : Optional.none();
32+
return Number.isNaN(n) ? Optional.none() : Optional.some(n);
3333
};
3434

3535
export const toPositiveInteger = (n: number): Optional<number> =>
@@ -117,7 +117,7 @@ A common way to handle an Optional value is to provide a default value if in the
117117
You can do this with fold, but getOr is a shortcut.
118118
*/
119119

120-
// TODO: Using getOr, take an Optional<{age: string}> and turn it into an {age: string}, using a default value of 0.
120+
// TODO: Using getOr, take an Optional<{age: number}> and turn it into an {age: number}, using a default value of 0.
121121

122122
// TODO: Write the same function using fold
123123

@@ -137,7 +137,7 @@ Let's explore this by converting Optionals to and from Arrays.
137137
One of the most useful functions on Optional is "map". We say this function "maps a function over the Optional".
138138
139139
If the Optional is some, it runs the function over the some and returns the result as a "some".
140-
If the Optional. is none, it returns none.
140+
If the Optional is none, it returns none.
141141
142142
Above, we talked about how an Optional is like an array restricted to 0 or 1 elements, so mapping over an Optional
143143
is very similar to mapping over an array (which we did in Exercise 2).

0 commit comments

Comments
 (0)