throw new TypeError('"value" argument must not be a number')
}
- if (isArrayBuffer(value)) {
+ if (isArrayBuffer(value) || (value && isArrayBuffer(value.buffer))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
// Test that ArrayBuffer from a different context is detected correctly
var arrayBuf = vm.runInNewContext('new ArrayBuffer()');
assert.doesNotThrow(() => Buffer.from(arrayBuf));
-/*
assert.doesNotThrow(() => Buffer.from({ buffer: arrayBuf }));
-
+/*
assert.throws(() => Buffer.alloc({ valueOf: () => 1 }),
/"size" argument must be of type number/);
assert.throws(() => Buffer.alloc({ valueOf: () => -1 }),