Skip to content

Misc editorial tweaks #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ <h1>Uint8Array.prototype.toBase64 ( [ _options_ ] )</h1>
1. Let _opts_ be ? GetOptionsObject(_options_).
1. Let _alphabet_ be ? Get(_opts_, *"alphabet"*).
1. If _alphabet_ is *undefined*, set _alphabet_ to *"base64"*.
1. If _alphabet_ is not a String, throw a *TypeError* exception.
1. If _alphabet_ is neither *"base64"* nor *"base64url"*, throw a *TypeError* exception.
1. Let _toEncode_ be ? GetUint8ArrayBytes(_O_).
1. If _alphabet_ is *"base64"*, then
Expand Down Expand Up @@ -56,7 +55,6 @@ <h1>Uint8Array.fromBase64 ( _string_ [ , _options_ ] )</h1>
1. Let _opts_ be ? GetOptionsObject(_options_).
1. Let _alphabet_ be ? Get(_opts_, *"alphabet"*).
1. If _alphabet_ is *undefined*, set _alphabet_ to *"base64"*.
1. If _alphabet_ is not a String, throw a *TypeError* exception.
1. If _alphabet_ is neither *"base64"* nor *"base64url"*, throw a *TypeError* exception.
1. Let _lastChunkHandling_ be ? Get(_opts_, *"lastChunkHandling"*).
1. If _lastChunkHandling_ is *undefined*, set _lastChunkHandling_ to *"loose"*.
Expand All @@ -78,16 +76,14 @@ <h1>Uint8Array.prototype.setFromBase64 ( _string_ [ , _options_ ] )</h1>
1. Let _opts_ be ? GetOptionsObject(_options_).
1. Let _alphabet_ be ? Get(_opts_, *"alphabet"*).
1. If _alphabet_ is *undefined*, set _alphabet_ to *"base64"*.
1. If _alphabet_ is not a String, throw a *TypeError* exception.
1. If _alphabet_ is neither *"base64"* nor *"base64url"*, throw a *TypeError* exception.
1. Let _lastChunkHandling_ be ? Get(_opts_, *"lastChunkHandling"*).
1. If _lastChunkHandling_ is *undefined*, set _lastChunkHandling_ to *"loose"*.
1. If _lastChunkHandling_ is not one of *"loose"*, *"strict"*, or *"stop-before-partial"*, throw a *TypeError* exception.
1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_into_, ~seq-cst~).
1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception.
1. Let _byteLength_ be TypedArrayByteLength(_taRecord_).
1. Let _maxLength_ be _byteLength_.
1. Let _result_ be ? FromBase64(_string_, _alphabet_, _lastChunkHandling_, _maxLength_).
1. Let _byteLength_ be TypedArrayLength(_taRecord_).
1. Let _result_ be ? FromBase64(_string_, _alphabet_, _lastChunkHandling_, _byteLength_).
1. Let _bytes_ be _result_.[[Bytes]].
1. Let _written_ be the length of _bytes_.
1. NOTE: FromBase64 does not invoke any user code, so the ArrayBuffer backing _into_ cannot have been detached or shrunk.
Expand Down Expand Up @@ -120,9 +116,8 @@ <h1>Uint8Array.prototype.setFromHex ( _string_ )</h1>
1. If _string_ is not a String, throw a *TypeError* exception.
1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_into_, ~seq-cst~).
1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception.
1. Let _byteLength_ be TypedArrayByteLength(_taRecord_).
1. Let _maxLength_ be _byteLength_.
1. Let _result_ be ? FromHex(_string_, _maxLength_).
1. Let _byteLength_ be TypedArrayLength(_taRecord_).
1. Let _result_ be ? FromHex(_string_, _byteLength_).
1. Let _bytes_ be _result_.[[Bytes]].
1. Let _written_ be the length of _bytes_.
1. NOTE: FromHex does not invoke any user code, so the ArrayBuffer backing _into_ cannot have been detached or shrunk.
Expand Down Expand Up @@ -225,7 +220,7 @@ <h1>
</h1>
<dl class="header">
</dl>
<p>The <dfn id="standard-base64-alphabet">standard base64 alphabet</dfn> is a List whose elements are the code points corresponding to every letter and number in the Unicode Basic Latin block along with *"+"* and *"/"*; that is, it is StringToCodePoints(*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"*).</p>
<p>The <dfn id="standard-base64-alphabet">standard base64 alphabet</dfn> is the String whose elements are the code units corresponding to every letter and number in the Unicode Basic Latin block along with *"+"* and *"/"*; that is, it is *"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"*.</p>
<emu-alg>
1. Let _chunkLength_ be the length of _chunk_.
1. If _chunkLength_ is 2, then
Expand Down Expand Up @@ -313,7 +308,7 @@ <h1>
1. If _char_ is either *"+"* or *"/"*, throw a *SyntaxError* exception.
1. Else if _char_ is *"-"*, set _char_ to *"+"*.
1. Else if _char_ is *"_"*, set _char_ to *"/"*.
1. If _char_ is not an element of the standard base64 alphabet, throw a *SyntaxError* exception.
1. If the sole code unit of _char_ is not an element of the standard base64 alphabet, throw a *SyntaxError* exception.
1. Let _remaining_ be _maxLength_ - the length of _bytes_.
1. If _remaining_ = 1 and _chunkLength_ = 2, or if _remaining_ = 2 and _chunkLength_ = 3, then
1. Return the Record { [[Read]]: _read_, [[Bytes]]: _bytes_ }.
Expand Down