Skip to content
This repository was archived by the owner on Sep 10, 2020. It is now read-only.

Update lodash.bind to version 4.0.0 πŸš€ #11

Merged
merged 5 commits into from
Jan 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 3 additions & 76 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,78 +1,5 @@
{
"plugins": [
"eslint-plugin-hapi"
],
"rules": {
"consistent-return": 0,
"vars-on-top": 0,
"one-var": 0,
"strict": 0,
"new-cap": 0,
"no-console": 0,
"no-constant-condition": 0,
"no-empty": 0,
"no-native-reassign": 0,
"no-underscore-dangle": 0,
"no-undef": 0,
"no-process-exit": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"no-unused-expressions": 0,
"no-regex-spaces": 0,
"no-catch-shadow": 0,
"global-strict": 0,
"handle-callback-err": 0,
"no-lonely-if": 0,
"space-in-brackets": 0,
"brace-style": 0,
"no-shadow": 0,
"hapi/no-shadow-relaxed": [1, { "ignore": ["err", "done"] }],
"hapi/hapi-capitalize-modules": [1, "global-scope-only"],
"hapi/hapi-scope-start": 1,
"array-bracket-spacing": 1,
"dot-notation": 1,
"eol-last": 1,
"camelcase": 1,
"no-trailing-spaces": 1,
"no-eq-null": 1,
"no-extend-native": 1,
"no-redeclare": 1,
"no-loop-func": 1,
"yoda": [1, "never"],
"sort-vars": 1,
"quotes": [2, "single"],
"consistent-this": [2, "self"],
"func-style": [2, "expression"],
"new-parens": 2,
"no-array-constructor": 2,
"no-new-object": 2,
"no-spaced-func": 2,
"no-mixed-spaces-and-tabs": 2,
"space-after-keywords": 2,
"semi": [2, "always"],
"semi-spacing": [2, { "before": false, "after": true }],
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": [1, { "words": true, "nonwords": false }],
"eqeqeq": 2,
"curly": [2, "all"],
"no-eval": 2,
"no-else-return": 2,
"no-return-assign": 2,
"no-new-wrappers": 2,
"comma-dangle": [2, "never"],
"no-sparse-arrays": 2,
"no-ex-assign": 2,
"indent": [2, 4],
"space-before-function-paren": 2,
"func-style": [2, "expression"],
"object-curly-spacing": [2, "always"],
"func-names": 1,
"valid-jsdoc": [2, {
"requireReturn": false,
"prefer": {
"return": "returns"
}
}]
}
"extend": [
"eslint-config-andyet/es5"
]
}
15 changes: 0 additions & 15 deletions browser/index.js

This file was deleted.

18 changes: 18 additions & 0 deletions browser_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Browser test code
* This code is browserified and sent to phantomjs
* as part of the test suite, it is not part of the
* library itself
*/

var JsonRpcWs = require('./browser');
var browserClient = JsonRpcWs.createClient();

Function.prototype.bind = require('function-bind');

browserClient.expose('info', function info (params, reply) {

reply(null, 'browser');
});

window.browserClient = browserClient;
10 changes: 3 additions & 7 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var uuid = require('uuid').v4;
var logger = require('debug')('json-rpc-ws');
var Errors = require('./errors');
var Assert = require('assert');
var Bind = require('lodash.bind');

/**
* Quarantined JSON.parse try/catch block in its own function
Expand Down Expand Up @@ -65,9 +64,9 @@ var Connection = function Connection (socket, parent) {
this.parent = parent;
this.responseHandlers = {};
if (this.parent.browser) {
this.socket.onmessage = Bind(this.message, this);
this.socket.onclose = Bind(socketClosed, this);
this.socket.onerror = Bind(socketError, this);
this.socket.onmessage = this.message.bind(this)
this.socket.onclose = socketClosed.bind(this);
this.socket.onerror = socketError.bind(this);
} else {
this.socket.on('message', this.message.bind(this));
this.socket.once('close', this.close.bind(this));
Expand Down Expand Up @@ -130,9 +129,6 @@ Connection.prototype.processPayload = function processPayload (payload) {
logger('handler got callback %j, %j', err, reply);
return this.sendResult(id, err, reply);
};
if (this.parent.browser) {
return handler.call(this, params, Bind(handlerCallback, this));
}
return handler.call(this, params, handlerCallback.bind(this));
}
// needs a result or error at this point
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"license": "MIT",
"dependencies": {
"debug": "^2.2.0",
"lodash.bind": "^3.1.0",
"uuid": "^2.0.1",
"ws": "^1.0.1"
},
Expand All @@ -38,14 +37,15 @@
"files": [
"index.js",
"browser.js",
"browser/*",
"lib/*"
],
"devDependencies": {
"browserify": "^13.0.0",
"code": "^2.0.1",
"eslint": "^1.1.0",
"eslint-config-andyet": "^1.0.0",
"eslint-plugin-hapi": "^4.0.0",
"function-bind": "^1.0.2",
"git-validate": "^2.0.3",
"jsdoc": "^3.3.2",
"lab": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ lab.experiment('json-rpc ws', function () {

process.env.PATH = process.env.PATH + ':./node_modules/.bin';
var b = Browserify();
b.add('./browser/index.js');
b.add('./browser_test.js');
b.bundle(function (err, buf) {

Code.expect(err).to.not.exist();
Expand Down