@@ -959,7 +959,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time
959
959
const str = ' Node.js' ;
960
960
const buf = Buffer .allocUnsafe (str .length );
961
961
962
- for (let i = 0 ; i < str .length ; i++ ) {
962
+ for (let i = 0 ; i < str .length ; i++ ) {
963
963
buf[i] = str .charCodeAt (i);
964
964
}
965
965
@@ -1087,7 +1087,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2`
1087
1087
const buf1 = Buffer .allocUnsafe (26 );
1088
1088
const buf2 = Buffer .allocUnsafe (26 ).fill (' !' );
1089
1089
1090
- for (let i = 0 ; i < 26 ; i++ ) {
1090
+ for (let i = 0 ; i < 26 ; i++ ) {
1091
1091
// 97 is the decimal ASCII value for 'a'
1092
1092
buf1[i] = i + 97 ;
1093
1093
}
@@ -1104,7 +1104,7 @@ overlapping region within the same `Buffer`
1104
1104
``` js
1105
1105
const buf = Buffer .allocUnsafe (26 );
1106
1106
1107
- for (let i = 0 ; i < 26 ; i++ ) {
1107
+ for (let i = 0 ; i < 26 ; i++ ) {
1108
1108
// 97 is the decimal ASCII value for 'a'
1109
1109
buf[i] = i + 97 ;
1110
1110
}
@@ -1871,7 +1871,7 @@ one byte from the original `Buffer`
1871
1871
``` js
1872
1872
const buf1 = Buffer .allocUnsafe (26 );
1873
1873
1874
- for (let i = 0 ; i < 26 ; i++ ) {
1874
+ for (let i = 0 ; i < 26 ; i++ ) {
1875
1875
// 97 is the decimal ASCII value for 'a'
1876
1876
buf1[i] = i + 97 ;
1877
1877
}
@@ -2021,9 +2021,9 @@ const json = JSON.stringify(buf);
2021
2021
console .log (json);
2022
2022
2023
2023
const 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;
2027
2027
});
2028
2028
2029
2029
// Prints: <Buffer 01 02 03 04 05>
@@ -2049,7 +2049,7 @@ Examples:
2049
2049
``` js
2050
2050
const buf1 = Buffer .allocUnsafe (26 );
2051
2051
2052
- for (let i = 0 ; i < 26 ; i++ ) {
2052
+ for (let i = 0 ; i < 26 ; i++ ) {
2053
2053
// 97 is the decimal ASCII value for 'a'
2054
2054
buf1[i] = i + 97 ;
2055
2055
}
0 commit comments