Skip to content

Commit ee2ae0f

Browse files
vishal7201addaleax
authored andcommitted
doc: expanded description of buffer.slice
Added description for the case when `end` is greater than buffer length PR-URL: #14720 Fixes: #14714 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 917ace2 commit ee2ae0f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

doc/api/buffer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,9 @@ changes:
19071907
Returns a new `Buffer` that references the same memory as the original, but
19081908
offset and cropped by the `start` and `end` indices.
19091909

1910+
Specifying `end` greater than [`buf.length`] will return the same result as
1911+
that of `end` equal to [`buf.length`].
1912+
19101913
*Note*: Modifying the new `Buffer` slice will modify the memory in the
19111914
original `Buffer` because the allocated memory of the two objects overlap.
19121915

0 commit comments

Comments
 (0)