@@ -37,7 +37,7 @@ namespace SassTypes
37
37
return Nan::ThrowTypeError (" Supplied index should be an integer" );
38
38
}
39
39
40
- Sass_Value* map = unwrap (info.This ())->value ;
40
+ Sass_Value* map = Map::Unwrap<Map> (info.This ())->value ;
41
41
size_t index = Nan::To<uint32_t >(info[0 ]).FromJust ();
42
42
43
43
@@ -63,14 +63,13 @@ namespace SassTypes
63
63
64
64
Value* sass_value = Factory::unwrap (info[1 ]);
65
65
if (sass_value) {
66
- sass_map_set_value (unwrap (info.This ())->value , Nan::To<uint32_t >(info[0 ]).FromJust (), sass_value->get_sass_value ());
66
+ sass_map_set_value (Map::Unwrap<Map> (info.This ())->value , Nan::To<uint32_t >(info[0 ]).FromJust (), sass_value->get_sass_value ());
67
67
} else {
68
68
Nan::ThrowTypeError (" A SassValue is expected as a map value" );
69
69
}
70
70
}
71
71
72
72
NAN_METHOD (Map::GetKey) {
73
-
74
73
if (info.Length () != 1 ) {
75
74
return Nan::ThrowTypeError (" Expected just one argument" );
76
75
}
@@ -79,15 +78,17 @@ namespace SassTypes
79
78
return Nan::ThrowTypeError (" Supplied index should be an integer" );
80
79
}
81
80
82
- Sass_Value* map = unwrap (info.This ())->value ;
81
+ Sass_Value* map = Map::Unwrap<Map> (info.This ())->value ;
83
82
size_t index = Nan::To<uint32_t >(info[0 ]).FromJust ();
84
83
85
84
86
85
if (index >= sass_map_get_length (map)) {
87
86
return Nan::ThrowRangeError (Nan::New (" Out of bound index" ).ToLocalChecked ());
88
87
}
89
88
90
- info.GetReturnValue ().Set (Factory::create (sass_map_get_key (map, Nan::To<uint32_t >(info[0 ]).FromJust ()))->get_js_object ());
89
+ SassTypes::Value* obj = Factory::create (sass_map_get_key (map, Nan::To<uint32_t >(info[0 ]).FromJust ()));
90
+ v8::Local<v8::Object> js_obj = obj->get_js_object ();
91
+ info.GetReturnValue ().Set (js_obj);
91
92
}
92
93
93
94
NAN_METHOD (Map::SetKey) {
@@ -105,13 +106,13 @@ namespace SassTypes
105
106
106
107
Value* sass_value = Factory::unwrap (info[1 ]);
107
108
if (sass_value) {
108
- sass_map_set_key (unwrap (info.This ())->value , Nan::To<uint32_t >(info[0 ]).FromJust (), sass_value->get_sass_value ());
109
+ sass_map_set_key (Map::Unwrap<Map> (info.This ())->value , Nan::To<uint32_t >(info[0 ]).FromJust (), sass_value->get_sass_value ());
109
110
} else {
110
111
Nan::ThrowTypeError (" A SassValue is expected as a map key" );
111
112
}
112
113
}
113
114
114
115
NAN_METHOD (Map::GetLength) {
115
- info.GetReturnValue ().Set (Nan::New<v8::Number>(sass_map_get_length (unwrap (info.This ())->value )));
116
+ info.GetReturnValue ().Set (Nan::New<v8::Number>(sass_map_get_length (Map::Unwrap<Map> (info.This ())->value )));
116
117
}
117
118
}
0 commit comments