Skip to content

Commit

Permalink
Nan::ReturnValue.Set() needs no Nan::New on primitive types
Browse files Browse the repository at this point in the history
For bool, double, [u]int32_t there is no need to wrap
a returned value in Nan::New()

https://github.com/nodejs/nan/blob/master/doc/methods.md#api_nan_return_value
  • Loading branch information
saper committed Aug 9, 2015
1 parent d96ad37 commit acd67bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ NAN_METHOD(render_sync) {

sass_free_context_wrapper(ctx_w);

info.GetReturnValue().Set(Nan::New<v8::Boolean>(result == 0));
info.GetReturnValue().Set(result == 0);
}

NAN_METHOD(render_file) {
Expand Down Expand Up @@ -297,7 +297,7 @@ NAN_METHOD(render_file_sync) {
free(input_path);
sass_free_context_wrapper(ctx_w);

info.GetReturnValue().Set(Nan::New<v8::Boolean>(result == 0));
info.GetReturnValue().Set(result == 0);
}

NAN_METHOD(libsass_version) {
Expand Down
8 changes: 4 additions & 4 deletions src/sass_types/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ namespace SassTypes
}

NAN_METHOD(Color::GetR) {
info.GetReturnValue().Set(Nan::New(sass_color_get_r(unwrap(info.This())->value)));
info.GetReturnValue().Set(sass_color_get_r(unwrap(info.This())->value));
}

NAN_METHOD(Color::GetG) {
info.GetReturnValue().Set(Nan::New(sass_color_get_g(unwrap(info.This())->value)));
info.GetReturnValue().Set(sass_color_get_g(unwrap(info.This())->value));
}

NAN_METHOD(Color::GetB) {
info.GetReturnValue().Set(Nan::New(sass_color_get_b(unwrap(info.This())->value)));
info.GetReturnValue().Set(sass_color_get_b(unwrap(info.This())->value));
}

NAN_METHOD(Color::GetA) {
info.GetReturnValue().Set(Nan::New(sass_color_get_a(unwrap(info.This())->value)));
info.GetReturnValue().Set(sass_color_get_a(unwrap(info.This())->value));
}

NAN_METHOD(Color::SetR) {
Expand Down
2 changes: 1 addition & 1 deletion src/sass_types/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace SassTypes
}

NAN_METHOD(List::GetSeparator) {
info.GetReturnValue().Set(Nan::New(sass_list_get_separator(unwrap(info.This())->value) == SASS_COMMA));
info.GetReturnValue().Set(sass_list_get_separator(unwrap(info.This())->value) == SASS_COMMA);
}

NAN_METHOD(List::SetSeparator) {
Expand Down

0 comments on commit acd67bf

Please sign in to comment.