Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 8429074

Browse files
authored
Update nan (#80)
* Update nan * Update node version * Update API usage
1 parent 1198557 commit 8429074

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ notifications:
99
node_js:
1010
- "8"
1111
- "10"
12-
- "12"
12+
- "12.14.1"
1313

1414
before_install:
1515
- export CXX="g++-4.9" CC="gcc-4.9"

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ image: Visual Studio 2015
33
environment:
44
matrix:
55
- nodejs_version: "8"
6-
- nodejs_version: "10"
6+
- nodejs_version: "12.14.1"
77

88
platform:
99
- x86

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"homepage": "https://github.com/atom/superstring",
3333
"dependencies": {
34-
"nan": "^2.13.2"
34+
"nan": "^2.14.2"
3535
},
3636
"devDependencies": {
3737
"chai": "^2.0.0",

src/bindings/marker-index-wrapper.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,24 @@ Local<Set> MarkerIndexWrapper::marker_ids_set_to_js(const MarkerIndex::MarkerIdS
109109

110110
Local<Array> MarkerIndexWrapper::marker_ids_vector_to_js(const std::vector<MarkerIndex::MarkerId> &marker_ids) {
111111
Local<Array> js_array = Nan::New<Array>(marker_ids.size());
112+
113+
Isolate *isolate = v8::Isolate::GetCurrent();
114+
Local<Context> context = isolate->GetCurrentContext();
112115
for (size_t i = 0; i < marker_ids.size(); i++) {
113-
Nan::Set(js_array, i, Nan::New<Integer>(marker_ids[i]));
116+
js_array->Set(context, i, Nan::New<Integer>(marker_ids[i]));
114117
}
115118
return js_array;
116119
}
117120

118121
Local<Object> MarkerIndexWrapper::snapshot_to_js(const unordered_map<MarkerIndex::MarkerId, Range> &snapshot) {
119122
Local<Object> result_object = Nan::New<Object>();
123+
Isolate *isolate = v8::Isolate::GetCurrent();
124+
Local<Context> context = isolate->GetCurrentContext();
120125
for (auto &pair : snapshot) {
121126
Local<Object> range = Nan::New<Object>();
122-
Nan::Set(range, Nan::New(start_string), PointWrapper::from_point(pair.second.start));
123-
Nan::Set(range, Nan::New(end_string), PointWrapper::from_point(pair.second.end));
124-
Nan::Set(result_object, Nan::New<Integer>(pair.first), range);
127+
range->Set(context, Nan::New(start_string), PointWrapper::from_point(pair.second.start));
128+
range->Set(context, Nan::New(end_string), PointWrapper::from_point(pair.second.end));
129+
result_object->Set(context, Nan::New<Integer>(pair.first), range);
125130
}
126131
return result_object;
127132
}

0 commit comments

Comments
 (0)