| 571 | } |
| 572 | |
| 573 | ::Windows::Foundation::Point PointFromJs(Local<Value> value) { |
| 574 | ::Windows::Foundation::Point point(0, 0); |
| 575 | |
| 576 | if (!value->IsObject()) { |
| 577 | Nan::ThrowError(Nan::Error( |
| 578 | NodeRT::Utils::NewString(L"Value to set is of unexpected type"))); |
| 579 | return point; |
| 580 | } |
| 581 | |
| 582 | Local<Object> obj = Nan::To<Object>(value).ToLocalChecked(); |
| 583 | |
| 584 | if (Nan::Has(obj, Nan::New<String>("x").ToLocalChecked()).FromMaybe(false)) { |
| 585 | point.X = static_cast<float>( |
| 586 | Nan::To<double>(Nan::Get(obj, Nan::New<String>("x").ToLocalChecked()) |
| 587 | .ToLocalChecked()) |
| 588 | .FromMaybe(0.0)); |
| 589 | } |
| 590 | |
| 591 | if (Nan::Has(obj, Nan::New<String>("y").ToLocalChecked()).FromMaybe(false)) { |
| 592 | point.Y = static_cast<float>( |
| 593 | Nan::To<double>(Nan::Get(obj, Nan::New<String>("y").ToLocalChecked()) |
| 594 | .ToLocalChecked()) |
| 595 | .FromMaybe(0.0)); |
| 596 | } |
| 597 | |
| 598 | return point; |
| 599 | } |
| 600 | |
| 601 | bool IsPoint(Local<Value> value) { |
| 602 | if (!value->IsObject()) { |
nothing calls this directly
no test coverage detected