MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / FillVector

Function FillVector

src/NodeRTLib/ProjectFiles/CollectionsConverter.h:184–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182// assumption: vec length >= arr length
183template <class T, class V>
184static bool FillVector(
185 v8::Local<v8::Array> arr,
186 const std::function<bool(v8::Local<v8::Value>)>& checkValueTypeFunc,
187 const std::function<V(v8::Local<v8::Value>)>& convertToValueTypeFunc,
188 T vec) {
189 for (uint32_t i = 0; i < arr->Length(); i++) {
190 Local<Value> value = Nan::Get(arr, i).ToLocalChecked();
191
192 if (!checkValueTypeFunc(value)) {
193 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
194 L"Received array with unexpected value type")));
195 return false;
196 }
197
198 InsertToVector(i, value, convertToValueTypeFunc, vec);
199 }
200
201 return true;
202}
203
204template <class K, class V>
205static bool FillMapFromJsArray(

Callers

nothing calls this directly

Calls 2

NewStringFunction · 0.85
InsertToVectorFunction · 0.85

Tested by

no test coverage detected