Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 03f9388

Browse filesBrowse files
seishunMylesBorins
authored andcommitted
doc: clarify out-of-bounds behavior of buf[index]
PR-URL: #11286 Fixes: #11244 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl>
1 parent eddfd52 commit 03f9388
Copy full SHA for 03f9388

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/buffer.md‎

Copy file name to clipboardExpand all lines: doc/api/buffer.md
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,10 @@ The index operator `[index]` can be used to get and set the octet at position
872872
`index` in `buf`. The values refer to individual bytes, so the legal value
873873
range is between `0x00` and `0xFF` (hex) or `0` and `255` (decimal).
874874

875+
This operator is inherited from `Uint8Array`, so its behavior on out-of-bounds
876+
access is the same as `UInt8Array` - that is, getting returns `undefined` and
877+
setting does nothing.
878+
875879
Example: Copy an ASCII string into a `Buffer`, one byte at a time
876880

877881
```js

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.