Skip to content

Commit

Permalink
Merge branch 'master' into es6
Browse files Browse the repository at this point in the history
  • Loading branch information
jbienkowski311 committed Jul 17, 2019
2 parents 8b8f944 + 43018e7 commit 72967a0
Show file tree
Hide file tree
Showing 11 changed files with 329 additions and 99 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: node_js
node_js:
- "10"
- "8"
- "10"
- "12"
os:
- linux
- osx
Expand All @@ -13,6 +14,7 @@ install:
- npm install
script:
- npm test
- npm run test-components
addons:
apt:
sources:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#### v 4.2.0 (2019-07-16) ####
* fix: Node.js 12 support
* fix: V8 and Nan deprecation warnings
* chore: reduce build output on Linux/Mac OS X. Pull request [183](https://github.com/yfinkelstein/node-zookeeper/pull/183) by @jbienkowski311
* fix: deprecated getters and setters, pull request [181](https://github.com/yfinkelstein/node-zookeeper/pull/181) by @jbienkowski311
* chore: pull request template, added by @jbienkowski311
* chore: added integration test scripts

#### v 4.1.1 (2019-06-18) ####
* feat: handle ZNOTHING return code from the ZooKeeper C library
* fix: README typos
Expand Down
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'/opt/local/include/zookeeper',
'<!(node -e "require(\'nan\')")'
],
'ldflags': ['-lzookeeper_st'],
'ldflags': ['-lzookeeper_st'],
}],
['OS=="mac"',{
'include_dirs': [
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zookeeper",
"description": "apache zookeeper client (zookeeper async API >= 3.4.0)",
"version": "4.1.1",
"version": "4.2.0",
"author": "Yuri Finkelstein <yurif2003@yahoo.com>",
"license": "MIT",
"contributors": [
Expand Down Expand Up @@ -46,10 +46,12 @@
"main": "lib/index",
"scripts": {
"build": "node-gyp configure build",
"build-components": "node-gyp configure build --directory=tests_components",
"install": "node ./scripts/prepublish.js && npm run build",
"lint": "eslint .",
"integrationtest": "/usr/bin/env bash -c 'pushd tests_integration; source ./test; popd'",
"test": "npm run lint && tape ./tests/**/*.js | tap-spec"
"test": "npm run lint && tape ./tests/**/*.js | tap-spec",
"test-components": "npm run build-components && tape ./tests_components/**/*.js | tap-spec"
},
"engines": {
"node": ">=8.9.4"
Expand Down
49 changes: 49 additions & 0 deletions src/converters.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <v8.h>
#include "nan.h"

using namespace v8;

namespace nodezk {
Local<Object> toLocalObj(Local<Value> val) {
return Nan::To<Object>(val).ToLocalChecked();
}

Local<Value> toLocalVal(Local<Object> arg, Local<String> propertyName) {
Local<Value> val_local = arg->Get(Nan::GetCurrentContext(), propertyName).ToLocalChecked();
return val_local;
}

int32_t toInt(Local<Value> val_local) {
int32_t val = val_local->Int32Value(Nan::GetCurrentContext()).FromJust();

return val;
}

int32_t toInt(Local<Object> arg, Local<String> propertyName) {
Local<Value> val_local = toLocalVal(arg, propertyName);

return toInt(val_local);
}

bool toBool(Local<Value> val_local) {
return Nan::To<bool>(val_local).FromJust();
}

bool toBool(Local<Object> arg, Local<String> propertyName) {
Local<Value> val_local = toLocalVal(arg, propertyName);

return toBool(val_local);
}

Local<Value> convertUnixTimeToDate(double time) {
return Date::New(Isolate::GetCurrent()->GetCurrentContext(), time).ToLocalChecked();
}

Local<String> toString(Local<Value> val) {
return val->ToString(Nan::GetCurrentContext()).FromMaybe(Local<String>());
}

uint32_t toUint(Local<Value> val) {
return val->Uint32Value(Nan::GetCurrentContext()).FromJust();
}
}
Loading

0 comments on commit 72967a0

Please sign in to comment.