Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jubaclient

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jubaclient - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.vscode/launch.json

17

app.js

@@ -0,1 +1,2 @@

const assert = require('assert');
const util = require('util');

@@ -18,2 +19,16 @@ const debug = util.debuglog('jubaclient');

}
exports.request = request;
exports.request = request;
function assertServiceMethod(service, method) {
assert.ok(typeof service === 'string', 'service is required.');
assert.ok(typeof method === 'string', 'method is required.');
const serviseName = toCamelCase('_' + service);
const namespace = serviseName.toLowerCase();
assert.ok(Object.keys(jubatus).some(key => namespace === key), `${ namespace } is unspport service.`);
const { [namespace]: { client: { [serviseName]: Service } } } = jubatus;
const methodName = toCamelCase(method);
assert.ok(Object.keys(Service.prototype).some(key => methodName === key), `${ methodName } is unspport method.`);
}
exports.assertServiceMethod = assertServiceMethod;

@@ -17,2 +17,4 @@ #!/usr/bin/env node

const { '_': [ service, method ], p: port, h: host, n: name, t: timeout } = argv;
app.assertServiceMethod(service, method);
const client = rpc.createClient(port, host, timeout);

@@ -19,0 +21,0 @@

3

package.json
{
"name": "jubaclient",
"version": "0.1.1",
"version": "0.1.2",
"description": "Jubatus CLI client (unofficial)",
"main": "index.js",
"bin": "index.js",
"man" : "./man/jubaclient.1",
"scripts": {

@@ -8,0 +9,0 @@ "test": "istanbul cover ./node_modules/mocha/bin/_mocha"

@@ -83,2 +83,19 @@ const expect = require('chai').expect;

});
});
describe('app#assertServiceMethod', () => {
it('support', done => {
expect(() => app.assertServiceMethod('classifier', 'get_status')).to.not.throw();
done();
});
it('unsupport service', done => {
expect(() => app.assertServiceMethod('foo', 'get_status')).to.throw(/service/);
done();
});
it('unsupport method', done => {
expect(() => app.assertServiceMethod('classifier', 'bar')).to.throw(/method/);
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