| 139 | } |
| 140 | |
| 141 | Vertex* 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 | |
| 167 | Nan::Persistent<v8::FunctionTemplate> Edge::_template; |
| 168 | |