Skip to content

Commit

Permalink
src: omit bool values of package.json main field
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 29, 2023
1 parent 59f57d2 commit d2ea291
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/node_modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,20 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
return throw_invalid_package_config();
}
} else if (key == "main") {
if (value.get_string(package_config.main)) {
if (value.type().get(field_type)) {
return throw_invalid_package_config();
}
switch (field_type) {
case simdjson::ondemand::json_type::boolean:
// Boolean values are omitted.
break;
default: {
if (value.get_string(package_config.main)) {
return throw_invalid_package_config();
}
break;
}
}
} else if (key == "exports") {
if (value.type().get(field_type)) {
return throw_invalid_package_config();
Expand Down

0 comments on commit d2ea291

Please sign in to comment.