New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-rethinkdb

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-rethinkdb - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

47

index.js

@@ -1,19 +0,17 @@

'use strict';
var rethink = require('rethinkdb')
var rethink = require('rethinkdb');
exports.register = function (plugin, opts, next) {
opts = opts || {};
opts = opts || {}
if (!opts.url) {
opts.port = opts.port || 28015;
opts.host = opts.host || 'localhost';
opts.db = opts.db || 'test';
opts.port = opts.port || 28015
opts.host = opts.host || 'localhost'
opts.db = opts.db || 'test'
} else {
var url = require('url').parse(opts.url);
opts.port = parseInt(url.port) || 28015;
opts.host = url.hostname || 'localhost';
opts.db = url.pathname ? url.pathname.replace(/^\//, '') : 'test';
var url = require('url').parse(opts.url)
opts.port = parseInt(url.port, 10) || 28015
opts.host = url.hostname || 'localhost'
opts.db = url.pathname ? url.pathname.replace(/^\//, '') : 'test'
if (url.auth)
opts.authKey = url.auth.split(':')[1];
opts.authKey = url.auth.split(':')[1]
}

@@ -23,21 +21,22 @@

if (err) {
plugin.log(['hapi-rethinkdb', 'error'], err.message);
console.error(err);
return next(err);
plugin.log(['hapi-rethinkdb', 'error'], err.message)
console.error(err)
return next(err)
}
plugin.expose('connection', conn);
plugin.expose('library', rethink);
plugin.expose('connection', conn)
plugin.expose('library', rethink)
plugin.expose('rethinkdb', rethink)
plugin.bind({
rethinkdbConn: conn,
rethinkdb: rethink
});
plugin.log(['hapi-rethinkdb', 'info'], 'RethinkDB connection established');
return next();
});
};
})
plugin.log(['hapi-rethinkdb', 'info'], 'RethinkDB connection established')
return next()
})
}
exports.register.attributes = {
pkg: require('./package.json')
};
}
{
"name": "hapi-rethinkdb",
"version": "2.0.0",
"version": "2.0.1",
"description": "Hapi's rethinkdb plugin",

@@ -28,3 +28,3 @@ "main": "index.js",

"devDependencies": {
"hapi": "^8.2.0",
"hapi": ">=8.2.0",
"rethinkdb": "^2.0.0",

@@ -34,5 +34,5 @@ "mocha": "^2.1.0"

"peerDependencies": {
"hapi": "^8.2.0",
"hapi": ">=8.2.0",
"rethinkdb": "^2.0.0"
}
}
hapi-rethinkdb
==============
Hapi (^8.0) plugin for `rethinkdb` [native driver](https://www.npmjs.com/package/rethinkdb).
Hapi (>=8.0) plugin for `rethinkdb` [native driver](https://www.npmjs.com/package/rethinkdb).

@@ -29,3 +29,3 @@ Install hapi-rethinkdb

The connection object returned by `rethinkdb.connect` callback is exposed on `server.plugins['hapi-rethinkdb'].connection` and binded to the context on routes and extensions as `this.rethinkdbConn`. You can find the `rethinkdb` library itself exposed on `server.plugins['hapi-rethinkdb'].library` or binded to the context on routes and extensions as `this.rethinkdb`.
The connection object returned by `rethinkdb.connect` callback is exposed on `server.plugins['hapi-rethinkdb'].connection` and binded to the context on routes and extensions as `this.rethinkdbConn`. You can find the `rethinkdb` library itself exposed on `server.plugins['hapi-rethinkdb'].library` and `server.plugins['hapi-rethinkdb'].rethinkdb` or binded to the context on routes and extensions as `this.rethinkdb`.

@@ -32,0 +32,0 @@ From a handler you can use it like:

/* global describe,it,afterEach,beforeEach */
'use strict';
var Hapi = require('hapi')
var assert = require('assert')
var Hapi = require('hapi');
var assert = require('assert');
describe('Testing Hapi RethinkDB plugin', function () {
var server = null;
var server = null
beforeEach(function () {
server = new Hapi.Server();
});
server = new Hapi.Server()
})
afterEach(function () {
server = null;
});
server = null
})

@@ -22,14 +20,14 @@ it('should be able to register the plugin with default options', function (done) {

}, function () {
assert(server.plugins['hapi-rethinkdb'].connection, 'No RethinkDB connection returned');
assert(server.plugins['hapi-rethinkdb'].connection, 'No RethinkDB connection returned')
assert(
server.plugins['hapi-rethinkdb'].connection.host === 'localhost',
'Connected to incorrect address'
);
)
assert(
server.plugins['hapi-rethinkdb'].connection.port === 28015,
'Connected to incorrect port'
);
done();
});
});
)
done()
})
})

@@ -40,6 +38,6 @@ it('should have connected', function (done) {

}, function () {
assert(server.plugins['hapi-rethinkdb'].connection.open, 'Did not connect');
done();
});
});
assert(server.plugins['hapi-rethinkdb'].connection.open, 'Did not connect')
done()
})
})

@@ -54,11 +52,11 @@ it('should take URLs as parameters', function (done) {

'Connected to incorrect address'
);
)
assert(
server.plugins['hapi-rethinkdb'].connection.port === 28015,
'Connected to incorrect port'
);
done();
});
});
)
done()
})
})
it('should take URLs as parameters and use 28015 port as default', function (done) {

@@ -72,11 +70,11 @@ server.register({

'Connected to incorrect address'
);
)
assert(
server.plugins['hapi-rethinkdb'].connection.port === 28015,
'Connected to incorrect port'
);
done();
});
});
)
done()
})
})
});
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc