buffer: make decodeUTF8 params loose

PR-URL: https://github.com/nodejs/node/pull/45610
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Yagiz Nizipli authored and Danielle Adams committed 2023-01-03 08:39:04 -05:00
1 parent e2da381609
commit bfcf4f0046
1 file changed
+2 -1
+2 -1
View File
@@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args); // list, flags
CHECK_GE(args.Length(), 1);
if (!(args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer() ||
args[0]->IsArrayBufferView())) {
return node::THROW_ERR_INVALID_ARG_TYPE(
@@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
ArrayBufferViewContents<char> buffer(args[0]);
CHECK(args[1]->IsBoolean());
bool ignore_bom = args[1]->IsTrue();
const char* data = buffer.data();