Skip to content

Commit 5df103b

Browse files
deserialization: Move answers to JavaScript
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 201edb7 commit 5df103b

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

docs/labs/deserialization.html

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@
1212

1313
<!-- See create_labs.md for how to create your own lab! -->
1414

15-
<!-- Sample expected answer -->
16-
<script id="expected0" type="plain/text">
17-
const data = JSON.parse(base64Decoded);
18-
</script>
19-
<!--
20-
-->
21-
<script id="expected1" type="plain/text">
22-
if (data.username && typeof data.username == 'string' && data.username.length < 20) {
23-
</script>
24-
25-
<!-- Full pattern of correct answer -->
26-
<script id="correct0" type="plain/text">
27-
\s* const data = JSON \. parse \( base64Decoded \) \; \s*
28-
</script>
29-
<script id="correct1" type="plain/text">
30-
\s* if \( CONDALL \) \{ \s*
31-
</script>
32-
3315
</head>
3416
<body>
3517
<!-- For GitHub Pages formatting: -->

docs/labs/deserialization.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ info =
104104
]
105105
}
106106
],
107+
expected: [
108+
' const data = JSON.parse(base64Decoded);',
109+
` if (data.username && typeof data.username == 'string' && data.username.length < 20) {`
110+
],
111+
correct: [
112+
String.raw`\s* const data = JSON \. parse \( base64Decoded \) \; \s*`,
113+
String.raw`\s* if \( CONDALL \) \{ \s*`
114+
],
107115
successes: [
108116
[
109117
"const data = JSON.parse(base64Decoded);",

0 commit comments

Comments
 (0)