MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / getOrCreateVertex

Function getOrCreateVertex

src/Edge.cc:141–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141Vertex* getOrCreateVertex(v8::Local<v8::Value> arg)
142{
143 Nan::HandleScope scope;
144
145 if (arg->IsArray()) {
146 auto objV = Nan::NewInstance(Constructor<Vertex>(), 1, &arg).ToLocalChecked();
147 if (!IsInstanceOf<Vertex>(objV)) {
148 return 0;
149 }
150 Vertex* vertex = my_unwrap<Vertex>(objV);
151 return vertex;
152 }
153 else if (arg->IsObject()) {
154
155 v8::Local<v8::Value> obj = Nan::To<v8::Object>(arg).ToLocalChecked();
156 if (!IsInstanceOf<Vertex>(obj)) {
157 return 0;
158 }
159 Vertex* vertex = Nan::ObjectWrap::Unwrap<Vertex>(Nan::To<v8::Object>(obj).ToLocalChecked());
160 return vertex;
161 }
162 else {
163 return 0;
164 }
165}
166
167Nan::Persistent<v8::FunctionTemplate> Edge::_template;
168

Callers 1

NAN_METHODFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected