Skip to content

Commit 170a48c

Browse files
Amxxernestognwarr00
authored
Apply suggestions from code review
Co-authored-by: Ernesto García <ernestognw@gmail.com> Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
1 parent c5d6081 commit 170a48c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contracts/utils/Bytes.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ library Bytes {
1313
* * If `s` is present in the buffer, returns the index of the first instance
1414
* * If `s` is not present in the buffer, returns type(uint256).max
1515
*
16-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
16+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
1717
*/
1818
function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {
1919
return indexOf(buffer, s, 0);
@@ -22,9 +22,9 @@ library Bytes {
2222
/**
2323
* @dev Forward search for `s` in `buffer` starting at position `pos`
2424
* * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance
25-
* * If `s` is not present in the buffer (at or after `pos`), returns the length of the buffer
25+
* * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max
2626
*
27-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
27+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
2828
*/
2929
function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
3030
unchecked {
@@ -43,7 +43,7 @@ library Bytes {
4343
* * If `s` is present in the buffer, returns the index of the last instance
4444
* * If `s` is not present in the buffer, returns type(uint256).max
4545
*
46-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
46+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
4747
*/
4848
function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {
4949
return lastIndexOf(buffer, s, type(uint256).max);
@@ -52,9 +52,9 @@ library Bytes {
5252
/**
5353
* @dev Backward search for `s` in `buffer` starting at position `pos`
5454
* * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance
55-
* * If `s` is not present in the buffer (at or before `pos`), returns the length of the buffer
55+
* * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max
5656
*
57-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
57+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
5858
*/
5959
function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
6060
unchecked {
@@ -73,7 +73,7 @@ library Bytes {
7373
* @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in
7474
* memory.
7575
*
76-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
76+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
7777
*/
7878
function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {
7979
return slice(buffer, start, buffer.length);
@@ -83,7 +83,7 @@ library Bytes {
8383
* @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in
8484
* memory.
8585
*
86-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
86+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
8787
*/
8888
function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {
8989
// sanitize

0 commit comments

Comments
 (0)