aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/builtins/js/JSBufferConstructor.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-21 23:03:43 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-21 23:03:43 -0800
commita2cfdf0e1c0353428f0682969e3fcfa86cc2d6a7 (patch)
treefa2ca92b403e50b2d464e2584296b2831818cf7c /src/bun.js/builtins/js/JSBufferConstructor.js
parent29a576a167f45eb5080bf79afae7a02fe682d75d (diff)
downloadbun-a2cfdf0e1c0353428f0682969e3fcfa86cc2d6a7.tar.gz
bun-a2cfdf0e1c0353428f0682969e3fcfa86cc2d6a7.tar.zst
bun-a2cfdf0e1c0353428f0682969e3fcfa86cc2d6a7.zip
Refactor `new Buffer` to pass Node.js tests
Diffstat (limited to 'src/bun.js/builtins/js/JSBufferConstructor.js')
-rw-r--r--src/bun.js/builtins/js/JSBufferConstructor.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/bun.js/builtins/js/JSBufferConstructor.js b/src/bun.js/builtins/js/JSBufferConstructor.js
index 4c3650360..10994394e 100644
--- a/src/bun.js/builtins/js/JSBufferConstructor.js
+++ b/src/bun.js/builtins/js/JSBufferConstructor.js
@@ -31,16 +31,12 @@ function from(items) {
if (!@isConstructor(this))
@throwTypeError("Buffer.from requires |this| to be a constructor");
- if (@isUndefinedOrNull(items))
+ if (@isUndefinedOrNull(items)) {
@throwTypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.",
);
-
- if (@argumentCount() === 1 && @isTypedArrayView(items)) {
- var out = this.allocUnsafe(items.byteLength);
- out.copy(items);
- return out;
}
+
// TODO: figure out why private symbol not found
if (