@@ -959,7 +959,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time
959959const str = ' Node.js' ;
960960const buf = Buffer .allocUnsafe (str .length );
961961
962- for (let i = 0 ; i < str .length ; i++ ) {
962+ for (let i = 0 ; i < str .length ; i++ ) {
963963 buf[i] = str .charCodeAt (i);
964964}
965965
@@ -1087,7 +1087,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2`
10871087const buf1 = Buffer .allocUnsafe (26 );
10881088const buf2 = Buffer .allocUnsafe (26 ).fill (' !' );
10891089
1090- for (let i = 0 ; i < 26 ; i++ ) {
1090+ for (let i = 0 ; i < 26 ; i++ ) {
10911091 // 97 is the decimal ASCII value for 'a'
10921092 buf1[i] = i + 97 ;
10931093}
@@ -1104,7 +1104,7 @@ overlapping region within the same `Buffer`
11041104``` js
11051105const buf = Buffer .allocUnsafe (26 );
11061106
1107- for (let i = 0 ; i < 26 ; i++ ) {
1107+ for (let i = 0 ; i < 26 ; i++ ) {
11081108 // 97 is the decimal ASCII value for 'a'
11091109 buf[i] = i + 97 ;
11101110}
@@ -1871,7 +1871,7 @@ one byte from the original `Buffer`
18711871``` js
18721872const buf1 = Buffer .allocUnsafe (26 );
18731873
1874- for (let i = 0 ; i < 26 ; i++ ) {
1874+ for (let i = 0 ; i < 26 ; i++ ) {
18751875 // 97 is the decimal ASCII value for 'a'
18761876 buf1[i] = i + 97 ;
18771877}
@@ -2021,9 +2021,9 @@ const json = JSON.stringify(buf);
20212021console .log (json);
20222022
20232023const copy = JSON .parse (json, (key , value ) => {
2024- return value && value .type === ' Buffer'
2025- ? Buffer .from (value .data )
2026- : value;
2024+ return value && value .type === ' Buffer' ?
2025+ Buffer .from (value .data ) :
2026+ value;
20272027});
20282028
20292029// Prints: <Buffer 01 02 03 04 05>
@@ -2049,7 +2049,7 @@ Examples:
20492049``` js
20502050const buf1 = Buffer .allocUnsafe (26 );
20512051
2052- for (let i = 0 ; i < 26 ; i++ ) {
2052+ for (let i = 0 ; i < 26 ; i++ ) {
20532053 // 97 is the decimal ASCII value for 'a'
20542054 buf1[i] = i + 97 ;
20552055}
0 commit comments