@@ -41,23 +41,23 @@ NAN_METHOD(imageDiff) {
4141 auto firstLength = Buffer::Length (firstBuffer);
4242 auto *firstData = reinterpret_cast <uint8_t *>(Buffer::Data (firstBuffer));
4343 // 2nd Parameter: The first image's width.
44- const auto firstWidth = static_cast <uint32_t >(info[1 ]-> NumberValue ());
44+ const auto firstWidth = static_cast <uint32_t >(Nan::To< uint32_t >( info[1 ]). ToChecked ());
4545 // 3rd Parameter: The first image's height.
46- const auto firstHeight = static_cast <uint32_t >(info[2 ]-> NumberValue ());
46+ const auto firstHeight = static_cast <uint32_t >(Nan::To< uint32_t >( info[2 ]). ToChecked ());
4747 // 4th Parameter: The second image's buffer.
4848 Local<Object> secondBuffer = Local<Object>::Cast (info[3 ]);
4949 auto secondLength = Buffer::Length (secondBuffer);
5050 auto *secondData = reinterpret_cast <uint8_t *>(Buffer::Data (secondBuffer));
5151 // 5th Parameter: The second image's width.
52- const auto secondWidth = static_cast <uint32_t >(info[4 ]-> NumberValue ());
52+ const auto secondWidth = static_cast <uint32_t >(Nan::To< uint32_t >( info[4 ]). ToChecked ());
5353 // 6th Parameter: The second image's height.
54- const auto secondHeight = static_cast <uint32_t >(info[5 ]-> NumberValue ());
54+ const auto secondHeight = static_cast <uint32_t >(Nan::To< uint32_t >( info[5 ]). ToChecked ());
5555 // 7th Parameter: The color threshold per pixel.
56- const auto colorThreshold = static_cast <float >(info[6 ]-> NumberValue ());
56+ const auto colorThreshold = static_cast <float >(Nan::To< double >( info[6 ]). ToChecked ());
5757 // 8th Parameter: Whether to check for antialiasing.
58- const auto checkAntialiasing = static_cast <bool >(info[7 ]-> BooleanValue ());
58+ const auto checkAntialiasing = static_cast <bool >(Nan::To< bool >( info[7 ]). ToChecked ());
5959 // 9th Parameter: Whether to generate an output image.
60- const auto generateDiffImage = static_cast <bool >(info[8 ]-> BooleanValue ());
60+ const auto generateDiffImage = static_cast <bool >(Nan::To< bool >( info[8 ]). ToChecked ());
6161 // Computed values.
6262 const uint32_t firstBytesPerPixel = firstLength / (firstWidth * firstHeight);
6363 const uint32_t secondBytesPerPixel = secondLength / (secondWidth * secondHeight);
@@ -125,5 +125,5 @@ NAN_METHOD(imageDiff) {
125125}
126126
127127NAN_MODULE_INIT (InitImageDiff) {
128- target->Set (Nan::New (" __native_imageDiff" ).ToLocalChecked (), Nan::New<FunctionTemplate>(imageDiff)-> GetFunction ());
128+ target->Set (Nan::New (" __native_imageDiff" ).ToLocalChecked (), Nan::GetFunction (Nan:: New<FunctionTemplate>(imageDiff)). ToLocalChecked ());
129129}
0 commit comments