New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OV JS] Remove acceptable_types parameter from js_to_cpp() template function #24459
[OV JS] Remove acceptable_types parameter from js_to_cpp() template function #24459
Conversation
…into almilosz/js-to-cpp
} else { | ||
OPENVINO_THROW("Passed argument must be of type Array or TypedArray."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If else is last instruction in the function body we can white it out of condition
} else { | |
OPENVINO_THROW("Passed argument must be of type Array or TypedArray."); | |
} | |
} | |
OPENVINO_THROW("Passed argument must be of type Array or TypedArray."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep it for the sake of readability
@@ -184,7 +145,7 @@ ov::preprocess::ResizeAlgorithm js_to_cpp<ov::preprocess::ResizeAlgorithm>( | |||
} else if (algorithm == "RESIZE_LINEAR") { | |||
return ov::preprocess::ResizeAlgorithm::RESIZE_LINEAR; | |||
} else { | |||
OPENVINO_THROW(std::string("Not supported resizeAlgorithm.")); | |||
OPENVINO_THROW("Not supported resizeAlgorithm."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to release from brackets
src/bindings/js/node/src/helper.cpp
Outdated
if (!acceptableType(elem, acceptable_types)) { | ||
OPENVINO_THROW(std::string("Cannot convert Napi::Value to std::map<std::string, ov::Any>")); | ||
} | ||
OPENVINO_ASSERT(elem.IsObject(), "Cannot convert Napi::Value to std::map<std::string, ov::Any>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Element at index idx should be an Object type
…into almilosz/js-to-cpp
Details:
const std::vector<napi_types>& acceptable_types
param from templateTargetType js_to_cpp(const Napi::Value&, const std::vector<napi_types>& acceptable_types);
int32_t js_to_cpp<int32_t>(const Napi::CallbackInfo& info, const size_t idx, const std::vector<napi_types>& acceptable_types);
Tickets: