diff --git a/.travis.yml b/.travis.yml index 5b2df215eef..5068cac219b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -177,9 +177,17 @@ matrix: - os: osx osx_image: xcode9.2 - compiler: "mason-osx-release-node-8" + compiler: "mason-osx-release-node-12" # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8" + env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12" + after_success: + - ./scripts/travis/publish.sh + + - os: osx + osx_image: xcode9.2 + compiler: "mason-osx-release-node-14" + # we use the xcode provides clang and don't install our own + env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14" after_success: - ./scripts/travis/publish.sh @@ -195,12 +203,60 @@ matrix: # Node build jobs. These skip running the tests. - os: linux sudo: false - compiler: "node-8-mason-linux-release" + compiler: "node-14-mason-linux-release" + addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['libstdc++-4.9-dev'] + env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14" + install: + - pushd ${OSRM_BUILD_DIR} + - | + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DENABLE_MASON=${ENABLE_MASON:-OFF} \ + -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ + -DENABLE_CCACHE=ON \ + -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ + -DENABLE_GLIBC_WORKAROUND=ON + - make --jobs=${JOBS} + - popd + script: + - npm run nodejs-tests + after_success: + - ./scripts/travis/publish.sh + + - os: linux + sudo: false + compiler: "node-14-mason-linux-debug" + addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['libstdc++-4.9-dev'] + env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14" + install: + - pushd ${OSRM_BUILD_DIR} + - | + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DENABLE_MASON=${ENABLE_MASON:-OFF} \ + -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ + -DENABLE_CCACHE=ON \ + -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ + -DENABLE_GLIBC_WORKAROUND=ON + - make --jobs=${JOBS} + - popd + script: + - npm run nodejs-tests + after_success: + - ./scripts/travis/publish.sh + + - os: linux + sudo: false + compiler: "node-12-mason-linux-release" addons: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" + env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12" install: - pushd ${OSRM_BUILD_DIR} - | @@ -219,12 +275,12 @@ matrix: - os: linux sudo: false - compiler: "node-8-mason-linux-debug" + compiler: "node-12-mason-linux-debug" addons: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" + env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12" install: - pushd ${OSRM_BUILD_DIR} - | diff --git a/CHANGELOG.md b/CHANGELOG.md index 8003a438c91..93e0aa1f787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Unreleased - Changes from 5.23.0 + - Features: + - ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918) + - REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918) - Misc: - CHANGED: Unify `.osrm.turn_penalites_index` dump processing same with `.osrm.turn_weight_penalties` and `.osrm.turn_duration_penalties` [#5868](https://github.com/Project-OSRM/osrm-backend/pull/5868) - Infrastructure diff --git a/include/nodejs/json_v8_renderer.hpp b/include/nodejs/json_v8_renderer.hpp index b23054a3b47..6e518293c9a 100644 --- a/include/nodejs/json_v8_renderer.hpp +++ b/include/nodejs/json_v8_renderer.hpp @@ -31,7 +31,7 @@ struct V8Renderer { v8::Local child; mapbox::util::apply_visitor(V8Renderer(child), keyValue.second); - obj->Set(Nan::New(keyValue.first).ToLocalChecked(), child); + Nan::Set(obj, Nan::New(keyValue.first).ToLocalChecked(), child); } out = obj; } @@ -43,7 +43,7 @@ struct V8Renderer { v8::Local child; mapbox::util::apply_visitor(V8Renderer(child), array.values[i]); - a->Set(i, child); + Nan::Set(a, i, child); } out = a; } diff --git a/include/nodejs/node_osrm_support.hpp b/include/nodejs/node_osrm_support.hpp index 90294a8417d..edd8f13d215 100644 --- a/include/nodejs/node_osrm_support.hpp +++ b/include/nodejs/node_osrm_support.hpp @@ -130,19 +130,20 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo BOOST_ASSERT(args[0]->IsObject()); auto params = Nan::To(args[0]).ToLocalChecked(); - auto path = params->Get(Nan::New("path").ToLocalChecked()); + auto path = Nan::Get(params, Nan::New("path").ToLocalChecked()).ToLocalChecked(); if (path.IsEmpty()) return engine_config_ptr(); - auto memory_file = params->Get(Nan::New("memory_file").ToLocalChecked()); + auto memory_file = Nan::Get(params, Nan::New("memory_file").ToLocalChecked()).ToLocalChecked(); if (memory_file.IsEmpty()) return engine_config_ptr(); - auto shared_memory = params->Get(Nan::New("shared_memory").ToLocalChecked()); + auto shared_memory = + Nan::Get(params, Nan::New("shared_memory").ToLocalChecked()).ToLocalChecked(); if (shared_memory.IsEmpty()) return engine_config_ptr(); - auto mmap_memory = params->Get(Nan::New("mmap_memory").ToLocalChecked()); + auto mmap_memory = Nan::Get(params, Nan::New("mmap_memory").ToLocalChecked()).ToLocalChecked(); if (mmap_memory.IsEmpty()) return engine_config_ptr(); @@ -158,7 +159,8 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo *Nan::Utf8String(Nan::To(memory_file).ToLocalChecked()); } - auto dataset_name = params->Get(Nan::New("dataset_name").ToLocalChecked()); + auto dataset_name = + Nan::Get(params, Nan::New("dataset_name").ToLocalChecked()).ToLocalChecked(); if (dataset_name.IsEmpty()) return engine_config_ptr(); if (!dataset_name->IsUndefined()) @@ -214,7 +216,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo return engine_config_ptr(); } - auto algorithm = params->Get(Nan::New("algorithm").ToLocalChecked()); + auto algorithm = Nan::Get(params, Nan::New("algorithm").ToLocalChecked()).ToLocalChecked(); if (algorithm.IsEmpty()) return engine_config_ptr(); @@ -247,16 +249,21 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo // Set EngineConfig system-wide limits on construction, if requested - auto max_locations_trip = params->Get(Nan::New("max_locations_trip").ToLocalChecked()); - auto max_locations_viaroute = params->Get(Nan::New("max_locations_viaroute").ToLocalChecked()); + auto max_locations_trip = + Nan::Get(params, Nan::New("max_locations_trip").ToLocalChecked()).ToLocalChecked(); + auto max_locations_viaroute = + Nan::Get(params, Nan::New("max_locations_viaroute").ToLocalChecked()).ToLocalChecked(); auto max_locations_distance_table = - params->Get(Nan::New("max_locations_distance_table").ToLocalChecked()); + Nan::Get(params, Nan::New("max_locations_distance_table").ToLocalChecked()) + .ToLocalChecked(); auto max_locations_map_matching = - params->Get(Nan::New("max_locations_map_matching").ToLocalChecked()); - auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked()); - auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked()); + Nan::Get(params, Nan::New("max_locations_map_matching").ToLocalChecked()).ToLocalChecked(); + auto max_results_nearest = + Nan::Get(params, Nan::New("max_results_nearest").ToLocalChecked()).ToLocalChecked(); + auto max_alternatives = + Nan::Get(params, Nan::New("max_alternatives").ToLocalChecked()).ToLocalChecked(); auto max_radius_map_matching = - params->Get(Nan::New("max_radius_map_matching").ToLocalChecked()); + Nan::Get(params, Nan::New("max_radius_map_matching").ToLocalChecked()).ToLocalChecked(); if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber()) { @@ -319,7 +326,7 @@ parseCoordinateArray(const v8::Local &coordinates_array) for (uint32_t i = 0; i < coordinates_array->Length(); ++i) { - v8::Local coordinate = coordinates_array->Get(i); + v8::Local coordinate = Nan::Get(coordinates_array, i).ToLocalChecked(); if (coordinate.IsEmpty()) return resulting_coordinates; @@ -336,14 +343,15 @@ parseCoordinateArray(const v8::Local &coordinates_array) return resulting_coordinates; } - if (!coordinate_pair->Get(0)->IsNumber() || !coordinate_pair->Get(1)->IsNumber()) + if (!Nan::Get(coordinate_pair, 0).ToLocalChecked()->IsNumber() || + !Nan::Get(coordinate_pair, 1).ToLocalChecked()->IsNumber()) { Nan::ThrowError("Each member of a coordinate pair must be a number"); return resulting_coordinates; } - double lon = Nan::To(coordinate_pair->Get(0)).FromJust(); - double lat = Nan::To(coordinate_pair->Get(1)).FromJust(); + double lon = Nan::To(Nan::Get(coordinate_pair, 0).ToLocalChecked()).FromJust(); + double lat = Nan::To(Nan::Get(coordinate_pair, 1).ToLocalChecked()).FromJust(); if (std::isnan(lon) || std::isnan(lat) || std::isinf(lon) || std::isinf(lat)) { @@ -388,7 +396,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg v8::Local obj = Nan::To(args[0]).ToLocalChecked(); - v8::Local coordinates = obj->Get(Nan::New("coordinates").ToLocalChecked()); + v8::Local coordinates = + Nan::Get(obj, Nan::New("coordinates").ToLocalChecked()).ToLocalChecked(); if (coordinates.IsEmpty()) return false; @@ -431,7 +440,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("approaches").ToLocalChecked()).FromJust()) { - v8::Local approaches = obj->Get(Nan::New("approaches").ToLocalChecked()); + v8::Local approaches = + Nan::Get(obj, Nan::New("approaches").ToLocalChecked()).ToLocalChecked(); if (approaches.IsEmpty()) return false; @@ -451,7 +461,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg for (uint32_t i = 0; i < approaches_array->Length(); ++i) { - v8::Local approach_raw = approaches_array->Get(i); + v8::Local approach_raw = Nan::Get(approaches_array, i).ToLocalChecked(); if (approach_raw.IsEmpty()) return false; @@ -488,7 +498,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("bearings").ToLocalChecked()).FromJust()) { - v8::Local bearings = obj->Get(Nan::New("bearings").ToLocalChecked()); + v8::Local bearings = + Nan::Get(obj, Nan::New("bearings").ToLocalChecked()).ToLocalChecked(); if (bearings.IsEmpty()) return false; @@ -508,7 +519,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg for (uint32_t i = 0; i < bearings_array->Length(); ++i) { - v8::Local bearing_raw = bearings_array->Get(i); + v8::Local bearing_raw = Nan::Get(bearings_array, i).ToLocalChecked(); if (bearing_raw.IsEmpty()) return false; @@ -521,14 +532,17 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg auto bearing_pair = v8::Local::Cast(bearing_raw); if (bearing_pair->Length() == 2) { - if (!bearing_pair->Get(0)->IsNumber() || !bearing_pair->Get(1)->IsNumber()) + if (!Nan::Get(bearing_pair, 0).ToLocalChecked()->IsNumber() || + !Nan::Get(bearing_pair, 1).ToLocalChecked()->IsNumber()) { Nan::ThrowError("Bearing values need to be numbers in range 0..360"); return false; } - const auto bearing = Nan::To(bearing_pair->Get(0)).FromJust(); - const auto range = Nan::To(bearing_pair->Get(1)).FromJust(); + const auto bearing = + Nan::To(Nan::Get(bearing_pair, 0).ToLocalChecked()).FromJust(); + const auto range = + Nan::To(Nan::Get(bearing_pair, 1).ToLocalChecked()).FromJust(); if (bearing < 0 || bearing > 360 || range < 0 || range > 180) { @@ -555,7 +569,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("hints").ToLocalChecked()).FromJust()) { - v8::Local hints = obj->Get(Nan::New("hints").ToLocalChecked()); + v8::Local hints = + Nan::Get(obj, Nan::New("hints").ToLocalChecked()).ToLocalChecked(); if (hints.IsEmpty()) return false; @@ -575,7 +590,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg for (uint32_t i = 0; i < hints_array->Length(); ++i) { - v8::Local hint = hints_array->Get(i); + v8::Local hint = Nan::Get(hints_array, i).ToLocalChecked(); if (hint.IsEmpty()) return false; @@ -603,7 +618,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("radiuses").ToLocalChecked()).FromJust()) { - v8::Local radiuses = obj->Get(Nan::New("radiuses").ToLocalChecked()); + v8::Local radiuses = + Nan::Get(obj, Nan::New("radiuses").ToLocalChecked()).ToLocalChecked(); if (radiuses.IsEmpty()) return false; @@ -623,7 +639,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg for (uint32_t i = 0; i < radiuses_array->Length(); ++i) { - v8::Local radius = radiuses_array->Get(i); + v8::Local radius = Nan::Get(radiuses_array, i).ToLocalChecked(); if (radius.IsEmpty()) return false; @@ -645,7 +661,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("generate_hints").ToLocalChecked()).FromJust()) { - v8::Local generate_hints = obj->Get(Nan::New("generate_hints").ToLocalChecked()); + v8::Local generate_hints = + Nan::Get(obj, Nan::New("generate_hints").ToLocalChecked()).ToLocalChecked(); if (generate_hints.IsEmpty()) return false; @@ -660,7 +677,8 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg if (Nan::Has(obj, Nan::New("exclude").ToLocalChecked()).FromJust()) { - v8::Local exclude = obj->Get(Nan::New("exclude").ToLocalChecked()); + v8::Local exclude = + Nan::Get(obj, Nan::New("exclude").ToLocalChecked()).ToLocalChecked(); if (exclude.IsEmpty()) return false; @@ -674,7 +692,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo &arg for (uint32_t i = 0; i < exclude_array->Length(); ++i) { - v8::Local class_name = exclude_array->Get(i); + v8::Local class_name = Nan::Get(exclude_array, i).ToLocalChecked(); if (class_name.IsEmpty()) return false; @@ -699,7 +717,7 @@ inline bool parseCommonParameters(const v8::Local &obj, ParamType &p { if (Nan::Has(obj, Nan::New("steps").ToLocalChecked()).FromJust()) { - auto steps = obj->Get(Nan::New("steps").ToLocalChecked()); + auto steps = Nan::Get(obj, Nan::New("steps").ToLocalChecked()).ToLocalChecked(); if (steps.IsEmpty()) return false; @@ -716,7 +734,7 @@ inline bool parseCommonParameters(const v8::Local &obj, ParamType &p if (Nan::Has(obj, Nan::New("annotations").ToLocalChecked()).FromJust()) { - auto annotations = obj->Get(Nan::New("annotations").ToLocalChecked()); + auto annotations = Nan::Get(obj, Nan::New("annotations").ToLocalChecked()).ToLocalChecked(); if (annotations.IsEmpty()) return false; @@ -729,7 +747,8 @@ inline bool parseCommonParameters(const v8::Local &obj, ParamType &p v8::Local annotations_array = v8::Local::Cast(annotations); for (std::size_t i = 0; i < annotations_array->Length(); i++) { - const Nan::Utf8String annotations_utf8str(annotations_array->Get(i)); + const Nan::Utf8String annotations_utf8str( + Nan::Get(annotations_array, i).ToLocalChecked()); std::string annotations_str{*annotations_utf8str, *annotations_utf8str + annotations_utf8str.length()}; @@ -779,7 +798,8 @@ inline bool parseCommonParameters(const v8::Local &obj, ParamType &p if (Nan::Has(obj, Nan::New("geometries").ToLocalChecked()).FromJust()) { - v8::Local geometries = obj->Get(Nan::New("geometries").ToLocalChecked()); + v8::Local geometries = + Nan::Get(obj, Nan::New("geometries").ToLocalChecked()).ToLocalChecked(); if (geometries.IsEmpty()) return false; @@ -813,7 +833,8 @@ inline bool parseCommonParameters(const v8::Local &obj, ParamType &p if (Nan::Has(obj, Nan::New("overview").ToLocalChecked()).FromJust()) { - v8::Local overview = obj->Get(Nan::New("overview").ToLocalChecked()); + v8::Local overview = + Nan::Get(obj, Nan::New("overview").ToLocalChecked()).ToLocalChecked(); if (overview.IsEmpty()) return false; @@ -859,7 +880,8 @@ argumentsToPluginParameters(const Nan::FunctionCallbackInfo &args) if (Nan::Has(obj, Nan::New("format").ToLocalChecked()).FromJust()) { - v8::Local format = obj->Get(Nan::New("format").ToLocalChecked()); + v8::Local format = + Nan::Get(obj, Nan::New("format").ToLocalChecked()).ToLocalChecked(); if (format.IsEmpty()) { return {}; @@ -905,7 +927,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("continue_straight").ToLocalChecked()).FromJust()) { - auto value = obj->Get(Nan::New("continue_straight").ToLocalChecked()); + auto value = Nan::Get(obj, Nan::New("continue_straight").ToLocalChecked()).ToLocalChecked(); if (value.IsEmpty()) return route_parameters_ptr(); @@ -922,7 +944,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("alternatives").ToLocalChecked()).FromJust()) { - auto value = obj->Get(Nan::New("alternatives").ToLocalChecked()); + auto value = Nan::Get(obj, Nan::New("alternatives").ToLocalChecked()).ToLocalChecked(); if (value.IsEmpty()) return route_parameters_ptr(); @@ -945,7 +967,8 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("waypoints").ToLocalChecked()).FromJust()) { - v8::Local waypoints = obj->Get(Nan::New("waypoints").ToLocalChecked()); + v8::Local waypoints = + Nan::Get(obj, Nan::New("waypoints").ToLocalChecked()).ToLocalChecked(); if (waypoints.IsEmpty()) return route_parameters_ptr(); @@ -967,9 +990,12 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, auto coords_size = params->coordinates.size(); auto waypoints_array_size = waypoints_array->Length(); - const auto first_index = Nan::To(waypoints_array->Get(0)).FromJust(); + const auto first_index = + Nan::To(Nan::Get(waypoints_array, 0).ToLocalChecked()).FromJust(); const auto last_index = - Nan::To(waypoints_array->Get(waypoints_array_size - 1)).FromJust(); + Nan::To( + Nan::Get(waypoints_array, waypoints_array_size - 1).ToLocalChecked()) + .FromJust(); if (first_index != 0 || last_index != coords_size - 1) { Nan::ThrowError("First and last waypoints values must correspond to first and last " @@ -979,7 +1005,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, for (uint32_t i = 0; i < waypoints_array_size; ++i) { - v8::Local waypoint_value = waypoints_array->Get(i); + v8::Local waypoint_value = Nan::Get(waypoints_array, i).ToLocalChecked(); // all elements must be numbers if (!waypoint_value->IsNumber()) { @@ -1011,7 +1037,8 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("snapping").ToLocalChecked()).FromJust()) { - v8::Local snapping = obj->Get(Nan::New("snapping").ToLocalChecked()); + v8::Local snapping = + Nan::Get(obj, Nan::New("snapping").ToLocalChecked()).ToLocalChecked(); if (snapping.IsEmpty()) return route_parameters_ptr(); @@ -1072,9 +1099,9 @@ argumentsToTileParameters(const Nan::FunctionCallbackInfo &args, bool return tile_parameters_ptr(); } - v8::Local x = array->Get(0); - v8::Local y = array->Get(1); - v8::Local z = array->Get(2); + v8::Local x = Nan::Get(array, 0).ToLocalChecked(); + v8::Local y = Nan::Get(array, 1).ToLocalChecked(); + v8::Local z = Nan::Get(array, 2).ToLocalChecked(); if (x.IsEmpty() || y.IsEmpty() || z.IsEmpty()) return tile_parameters_ptr(); @@ -1122,7 +1149,8 @@ argumentsToNearestParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("number").ToLocalChecked()).FromJust()) { - v8::Local number = obj->Get(Nan::New("number").ToLocalChecked()); + v8::Local number = + Nan::Get(obj, Nan::New("number").ToLocalChecked()).ToLocalChecked(); if (!number->IsUint32()) { @@ -1161,7 +1189,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("sources").ToLocalChecked()).FromJust()) { - v8::Local sources = obj->Get(Nan::New("sources").ToLocalChecked()); + v8::Local sources = + Nan::Get(obj, Nan::New("sources").ToLocalChecked()).ToLocalChecked(); if (sources.IsEmpty()) return table_parameters_ptr(); @@ -1174,7 +1203,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, v8::Local sources_array = v8::Local::Cast(sources); for (uint32_t i = 0; i < sources_array->Length(); ++i) { - v8::Local source = sources_array->Get(i); + v8::Local source = Nan::Get(sources_array, i).ToLocalChecked(); if (source.IsEmpty()) return table_parameters_ptr(); @@ -1200,7 +1229,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("destinations").ToLocalChecked()).FromJust()) { - v8::Local destinations = obj->Get(Nan::New("destinations").ToLocalChecked()); + v8::Local destinations = + Nan::Get(obj, Nan::New("destinations").ToLocalChecked()).ToLocalChecked(); if (destinations.IsEmpty()) return table_parameters_ptr(); @@ -1213,7 +1243,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, v8::Local destinations_array = v8::Local::Cast(destinations); for (uint32_t i = 0; i < destinations_array->Length(); ++i) { - v8::Local destination = destinations_array->Get(i); + v8::Local destination = Nan::Get(destinations_array, i).ToLocalChecked(); if (destination.IsEmpty()) return table_parameters_ptr(); @@ -1239,7 +1269,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("annotations").ToLocalChecked()).FromJust()) { - v8::Local annotations = obj->Get(Nan::New("annotations").ToLocalChecked()); + v8::Local annotations = + Nan::Get(obj, Nan::New("annotations").ToLocalChecked()).ToLocalChecked(); if (annotations.IsEmpty()) return table_parameters_ptr(); @@ -1255,7 +1286,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, v8::Local annotations_array = v8::Local::Cast(annotations); for (std::size_t i = 0; i < annotations_array->Length(); ++i) { - const Nan::Utf8String annotations_utf8str(annotations_array->Get(i)); + const Nan::Utf8String annotations_utf8str( + Nan::Get(annotations_array, i).ToLocalChecked()); std::string annotations_str{*annotations_utf8str, *annotations_utf8str + annotations_utf8str.length()}; @@ -1279,7 +1311,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("fallback_speed").ToLocalChecked()).FromJust()) { - auto fallback_speed = obj->Get(Nan::New("fallback_speed").ToLocalChecked()); + auto fallback_speed = + Nan::Get(obj, Nan::New("fallback_speed").ToLocalChecked()).ToLocalChecked(); if (!fallback_speed->IsNumber()) { @@ -1297,7 +1330,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("fallback_coordinate").ToLocalChecked()).FromJust()) { - auto fallback_coordinate = obj->Get(Nan::New("fallback_coordinate").ToLocalChecked()); + auto fallback_coordinate = + Nan::Get(obj, Nan::New("fallback_coordinate").ToLocalChecked()).ToLocalChecked(); if (!fallback_coordinate->IsString()) { @@ -1325,7 +1359,8 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("scale_factor").ToLocalChecked()).FromJust()) { - auto scale_factor = obj->Get(Nan::New("scale_factor").ToLocalChecked()); + auto scale_factor = + Nan::Get(obj, Nan::New("scale_factor").ToLocalChecked()).ToLocalChecked(); if (!scale_factor->IsNumber()) { @@ -1363,7 +1398,7 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("roundtrip").ToLocalChecked()).FromJust()) { - auto roundtrip = obj->Get(Nan::New("roundtrip").ToLocalChecked()); + auto roundtrip = Nan::Get(obj, Nan::New("roundtrip").ToLocalChecked()).ToLocalChecked(); if (roundtrip.IsEmpty()) return trip_parameters_ptr(); @@ -1380,7 +1415,8 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("source").ToLocalChecked()).FromJust()) { - v8::Local source = obj->Get(Nan::New("source").ToLocalChecked()); + v8::Local source = + Nan::Get(obj, Nan::New("source").ToLocalChecked()).ToLocalChecked(); if (source.IsEmpty()) return trip_parameters_ptr(); @@ -1409,7 +1445,8 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("destination").ToLocalChecked()).FromJust()) { - v8::Local destination = obj->Get(Nan::New("destination").ToLocalChecked()); + v8::Local destination = + Nan::Get(obj, Nan::New("destination").ToLocalChecked()).ToLocalChecked(); if (destination.IsEmpty()) return trip_parameters_ptr(); @@ -1452,7 +1489,8 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("timestamps").ToLocalChecked()).FromJust()) { - v8::Local timestamps = obj->Get(Nan::New("timestamps").ToLocalChecked()); + v8::Local timestamps = + Nan::Get(obj, Nan::New("timestamps").ToLocalChecked()).ToLocalChecked(); if (timestamps.IsEmpty()) return match_parameters_ptr(); @@ -1473,7 +1511,7 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, for (uint32_t i = 0; i < timestamps_array->Length(); ++i) { - v8::Local timestamp = timestamps_array->Get(i); + v8::Local timestamp = Nan::Get(timestamps_array, i).ToLocalChecked(); if (timestamp.IsEmpty()) return match_parameters_ptr(); @@ -1488,7 +1526,8 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("gaps").ToLocalChecked()).FromJust()) { - v8::Local gaps = obj->Get(Nan::New("gaps").ToLocalChecked()); + v8::Local gaps = + Nan::Get(obj, Nan::New("gaps").ToLocalChecked()).ToLocalChecked(); if (gaps.IsEmpty()) return match_parameters_ptr(); @@ -1518,7 +1557,8 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("tidy").ToLocalChecked()).FromJust()) { - v8::Local tidy = obj->Get(Nan::New("tidy").ToLocalChecked()); + v8::Local tidy = + Nan::Get(obj, Nan::New("tidy").ToLocalChecked()).ToLocalChecked(); if (tidy.IsEmpty()) return match_parameters_ptr(); @@ -1533,7 +1573,8 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, if (Nan::Has(obj, Nan::New("waypoints").ToLocalChecked()).FromJust()) { - v8::Local waypoints = obj->Get(Nan::New("waypoints").ToLocalChecked()); + v8::Local waypoints = + Nan::Get(obj, Nan::New("waypoints").ToLocalChecked()).ToLocalChecked(); if (waypoints.IsEmpty()) return match_parameters_ptr(); @@ -1555,9 +1596,12 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, auto coords_size = params->coordinates.size(); auto waypoints_array_size = waypoints_array->Length(); - const auto first_index = Nan::To(waypoints_array->Get(0)).FromJust(); + const auto first_index = + Nan::To(Nan::Get(waypoints_array, 0).ToLocalChecked()).FromJust(); const auto last_index = - Nan::To(waypoints_array->Get(waypoints_array_size - 1)).FromJust(); + Nan::To( + Nan::Get(waypoints_array, waypoints_array_size - 1).ToLocalChecked()) + .FromJust(); if (first_index != 0 || last_index != coords_size - 1) { Nan::ThrowError("First and last waypoints values must correspond to first and last " @@ -1567,7 +1611,7 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo &args, for (uint32_t i = 0; i < waypoints_array_size; ++i) { - v8::Local waypoint_value = waypoints_array->Get(i); + v8::Local waypoint_value = Nan::Get(waypoints_array, i).ToLocalChecked(); // all elements must be numbers if (!waypoint_value->IsNumber()) {