Skip to content

Commit d5a1b1a

Browse files
trevnorrisjasnell
authored andcommitted
buffer: clean up usage of __proto__
Prefer using Object.setPrototypeOf() instead. PR-URL: #3080 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent e0fffca commit d5a1b1a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/buffer.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ function Buffer(arg) {
5858
return fromObject(arg);
5959
}
6060

61-
Buffer.prototype.__proto__ = Uint8Array.prototype;
62-
Buffer.__proto__ = Uint8Array;
61+
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
62+
Object.setPrototypeOf(Buffer, Uint8Array);
6363

6464

6565
function SlowBuffer(length) {
@@ -72,8 +72,8 @@ function SlowBuffer(length) {
7272
return ui8;
7373
}
7474

75-
SlowBuffer.prototype.__proto__ = Buffer.prototype;
76-
SlowBuffer.__proto__ = Buffer;
75+
Object.setPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype);
76+
Object.setPrototypeOf(SlowBuffer, Uint8Array);
7777

7878

7979
function allocate(size) {

0 commit comments

Comments
 (0)