Commit beca324
committed
buffer: allow Uint8Array input to methods
Allow all methods on `buffer` and `Buffer` to take `Uint8Array`
arguments where it makes sense. On the native side, there is
effectively no difference, and as a bonus the `isUint8Array`
check is faster than `instanceof Buffer`.
PR-URL: #10236
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>1 parent 6cb33c0 commit beca324Copy full SHA for beca324
File tree
Expand file treeCollapse file tree
10 files changed
+81
-45
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal
- src
- test/parallel
Expand file treeCollapse file tree
10 files changed
+81
-45
lines changedOpen diff view settings
Collapse file
+12-12Lines changed: 12 additions & 12 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
635 | 635 | |
636 | 636 | |
637 | 637 | |
638 | | - |
639 | | - |
| 638 | + |
| 639 | + |
640 | 640 | |
641 | 641 | |
642 | 642 | |
| ||
660 | 660 | |
661 | 661 | |
662 | 662 | |
663 | | - |
| 663 | + |
664 | 664 | |
665 | 665 | |
666 | 666 | |
| ||
882 | 882 | |
883 | 883 | |
884 | 884 | |
885 | | - |
| 885 | + |
886 | 886 | |
887 | 887 | |
888 | 888 | |
| ||
1037 | 1037 | |
1038 | 1038 | |
1039 | 1039 | |
1040 | | - |
| 1040 | + |
1041 | 1041 | |
1042 | 1042 | |
1043 | 1043 | |
| ||
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | |
1102 | | - |
| 1102 | + |
1103 | 1103 | |
1104 | 1104 | |
1105 | 1105 | |
| ||
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | |
1113 | | - |
1114 | | - |
| 1113 | + |
| 1114 | + |
1115 | 1115 | |
1116 | 1116 | |
1117 | 1117 | |
| ||
1221 | 1221 | |
1222 | 1222 | |
1223 | 1223 | |
1224 | | - |
| 1224 | + |
1225 | 1225 | |
1226 | 1226 | |
1227 | 1227 | |
| ||
2313 | 2313 | |
2314 | 2314 | |
2315 | 2315 | |
2316 | | - |
| 2316 | + |
2317 | 2317 | |
2318 | 2318 | |
2319 | 2319 | |
2320 | | - |
2321 | | - |
| 2320 | + |
| 2321 | + |
2322 | 2322 | |
2323 | 2323 | |
2324 | 2324 | |
|
Collapse file
+25-18Lines changed: 25 additions & 18 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
| 5 | + |
| 6 | + |
6 | 7 | |
7 | 8 | |
8 | 9 | |
| ||
251 | 252 | |
252 | 253 | |
253 | 254 | |
254 | | - |
| 255 | + |
255 | 256 | |
256 | 257 | |
257 | 258 | |
258 | 259 | |
259 | 260 | |
260 | | - |
| 261 | + |
261 | 262 | |
262 | 263 | |
263 | 264 | |
| ||
287 | 288 | |
288 | 289 | |
289 | 290 | |
290 | | - |
291 | | - |
292 | | - |
| 291 | + |
| 292 | + |
293 | 293 | |
294 | 294 | |
295 | 295 | |
| ||
306 | 306 | |
307 | 307 | |
308 | 308 | |
| 309 | + |
| 310 | + |
| 311 | + |
309 | 312 | |
310 | 313 | |
311 | 314 | |
312 | | - |
| 315 | + |
313 | 316 | |
314 | 317 | |
315 | 318 | |
| ||
326 | 329 | |
327 | 330 | |
328 | 331 | |
329 | | - |
330 | | - |
331 | | - |
| 332 | + |
| 333 | + |
| 334 | + |
332 | 335 | |
333 | 336 | |
334 | 337 | |
| ||
495 | 498 | |
496 | 499 | |
497 | 500 | |
| 501 | + |
| 502 | + |
| 503 | + |
498 | 504 | |
499 | 505 | |
500 | 506 | |
| ||
510 | 516 | |
511 | 517 | |
512 | 518 | |
513 | | - |
514 | | - |
| 519 | + |
| 520 | + |
515 | 521 | |
516 | 522 | |
517 | 523 | |
| ||
539 | 545 | |
540 | 546 | |
541 | 547 | |
542 | | - |
543 | | - |
| 548 | + |
| 549 | + |
544 | 550 | |
545 | 551 | |
546 | 552 | |
| ||
604 | 610 | |
605 | 611 | |
606 | 612 | |
607 | | - |
| 613 | + |
608 | 614 | |
609 | 615 | |
610 | 616 | |
611 | 617 | |
612 | 618 | |
613 | | - |
| 619 | + |
| 620 | + |
614 | 621 | |
615 | 622 | |
616 | 623 | |
| ||
1037 | 1044 | |
1038 | 1045 | |
1039 | 1046 | |
1040 | | - |
1041 | | - |
| 1047 | + |
| 1048 | + |
1042 | 1049 | |
1043 | 1050 | |
1044 | 1051 | |
|
Collapse file
+4-3Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
| 11 | + |
11 | 12 | |
12 | 13 | |
13 | 14 | |
14 | 15 | |
15 | | - |
16 | | - |
| 16 | + |
| 17 | + |
17 | 18 | |
18 | 19 | |
19 | 20 | |
20 | 21 | |
21 | 22 | |
22 | | - |
| 23 | + |
23 | 24 | |
24 | 25 | |
25 | 26 | |
|
Collapse file
+9-9Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
519 | 519 | |
520 | 520 | |
521 | 521 | |
522 | | - |
| 522 | + |
523 | 523 | |
524 | 524 | |
525 | 525 | |
526 | | - |
527 | 526 | |
528 | | - |
529 | | - |
| 527 | + |
| 528 | + |
| 529 | + |
| 530 | + |
530 | 531 | |
531 | 532 | |
532 | 533 | |
533 | 534 | |
534 | 535 | |
535 | 536 | |
536 | | - |
537 | | - |
538 | | - |
| 537 | + |
| 538 | + |
| 539 | + |
539 | 540 | |
540 | 541 | |
541 | 542 | |
| ||
1203 | 1204 | |
1204 | 1205 | |
1205 | 1206 | |
1206 | | - |
1207 | | - |
1208 | 1207 | |
1209 | 1208 | |
1210 | 1209 | |
| ||
1227 | 1226 | |
1228 | 1227 | |
1229 | 1228 | |
| 1229 | + |
1230 | 1230 | |
1231 | 1231 | |
1232 | 1232 | |
|
Collapse file
+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | | - |
| 32 | + |
| 33 | + |
33 | 34 | |
34 | 35 | |
35 | 36 | |
|
Collapse file
test/parallel/test-buffer-compare.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-compare.js+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
| 9 | + |
9 | 10 | |
10 | 11 | |
11 | 12 | |
12 | 13 | |
| 14 | + |
13 | 15 | |
14 | 16 | |
15 | 17 | |
| ||
18 | 20 | |
19 | 21 | |
20 | 22 | |
| 23 | + |
| 24 | + |
| 25 | + |
21 | 26 | |
22 | 27 | |
23 | 28 | |
|
Collapse file
test/parallel/test-buffer-concat.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-concat.js+6-1Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | | - |
| 38 | + |
| 39 | + |
39 | 40 | |
40 | 41 | |
41 | 42 | |
| ||
60 | 61 | |
61 | 62 | |
62 | 63 | |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
Collapse file
test/parallel/test-buffer-equals.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-equals.js+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
12 | 12 | |
13 | 13 | |
14 | 14 | |
| 15 | + |
15 | 16 | |
16 | 17 | |
Collapse file
test/parallel/test-buffer-indexof.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-indexof.js+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
524 | 524 | |
525 | 525 | |
526 | 526 | |
| 527 | + |
| 528 | + |
| 529 | + |
| 530 | + |
| 531 | + |
| 532 | + |
| 533 | + |
| 534 | + |
Collapse file
test/parallel/test-icu-transcode.js
Copy file name to clipboardExpand all lines: test/parallel/test-icu-transcode.js+9-1Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | | - |
| 43 | + |
44 | 44 | |
45 | 45 | |
46 | 46 | |
| ||
62 | 62 | |
63 | 63 | |
64 | 64 | |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
0 commit comments