Skip to content

Commit

Permalink
doc: expanded description of buffer.slice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vishal7201 authored and refack committed Aug 12, 2017
1 parent 835c383 commit 89d9cc7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,9 @@ changes:
Returns a new `Buffer` that references the same memory as the original, but
offset and cropped by the `start` and `end` indices.

Specifying `end` greater than [`buf.length`] will return the same result as
that of `end` equal to [`buf.length`].

*Note*: Modifying the new `Buffer` slice will modify the memory in the
original `Buffer` because the allocated memory of the two objects overlap.

Expand Down

0 comments on commit 89d9cc7

Please sign in to comment.