Skip to content

Commit 235983e

Browse files
committed
Add Nodejs 6/7 support
1 parent 399f229 commit 235983e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Node v4.x.x/5.x.x Now Supported
1+
Node v6.x.x/7.x.x Now Supported
22
---------------------------
33

44
Many thanks to [Mário Freitas/imkira](https://github.com/imkira) for his work.
@@ -15,7 +15,9 @@ Works/worked with NodeJS versions:
1515
* 0.8.x,
1616
* 0.10.x,
1717
* 4.x.x,
18-
* 5.x.x
18+
* 5.x.x,
19+
* 6.x.x,
20+
* 7.x.x
1921

2022
To install, just type:
2123

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"test": "node test/unittest.js"
1818
},
1919
"dependencies": {
20-
"nan": "~2.1.0"
20+
"nan": "~2.5.1"
2121
}
2222
}

protobuf_for_node.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace protobuf_for_node {
106106
}
107107

108108
Local<Object> NewObject(Local<Value> properties) const {
109-
return Constructor()->NewInstance(1, &properties);
109+
return Nan::NewInstance(Constructor(), 1, &properties).ToLocalChecked();
110110
}
111111

112112
Type(Schema* schema, const Descriptor* descriptor, Local<Object> self)
@@ -139,7 +139,7 @@ namespace protobuf_for_node {
139139

140140
Local<Function> constructor =
141141
Script::Compile(Nan::New<String>(from.str()).ToLocalChecked())->Run().As<Function>();
142-
constructor->SetHiddenValue(Nan::New<String>("type").ToLocalChecked(), self);
142+
Nan::SetPrivate(constructor, Nan::New<String>("type").ToLocalChecked(), self);
143143

144144
Local<Function> bind =
145145
Script::Compile(Nan::New<String>(
@@ -427,7 +427,7 @@ namespace protobuf_for_node {
427427

428428
Local<FunctionTemplate> typeTemplate = Nan::New(TypeTemplate);
429429
result = types_[descriptor] =
430-
new Type(this, descriptor, typeTemplate->GetFunction()->NewInstance());
430+
new Type(this, descriptor, Nan::NewInstance(typeTemplate->GetFunction()).ToLocalChecked());
431431

432432
// managed schema->[type] link
433433
//

0 commit comments

Comments
 (0)