Skip to content

Commit

Permalink
Handle JS values which JSON-stringify as undefined
Browse files Browse the repository at this point in the history
Closes #264.
  • Loading branch information
domenic authored May 13, 2020
1 parent 48cfbaf commit 0aad1a9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions infra.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,13 +1351,21 @@ steps:

<ol>
<li>
<p>Let <var>jsonString</var> be
<p>Let <var>result</var> be
? <a abstract-op>Call</a>(<a>%JSONStringify%</a>, undefined, « <var>value</var> »).

<p class=note>Since no additional arguments are passed to <a>%JSONStringify%</a>, the resulting
string will have no whitespace inserted.

<li><p>Return the result of running <a>UTF-8 encode</a> on <var>jsonString</var>. [[!ENCODING]]
<li>
<p>If <var>result</var> is undefined, then throw a {{TypeError}}.

<p class="note">This can happen if <var>value</var> does not have a JSON representation, e.g., if
it is undefined or a function.

<li><p><a>Assert</a>: <var>result</var> is a <a>string</a>.

<li><p>Return the result of running <a>UTF-8 encode</a> on <var>result</var>. [[!ENCODING]]
</ol>

<hr>
Expand Down

0 comments on commit 0aad1a9

Please sign in to comment.