Skip to content

Commit

Permalink
Resolves #290 remove util._extend in favor of Object assign
Browse files Browse the repository at this point in the history
  • Loading branch information
thoreinstein committed Apr 28, 2016
1 parent b78faaa commit da2c753
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 62 deletions.
3 changes: 1 addition & 2 deletions cli/src/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const logger = horizon_server.logger;
const path = require('path');
const toml = require('toml');
const url = require('url');
const extend = require('util')._extend;

const start_rdb_server = require('./utils/start_rdb_server');

Expand Down Expand Up @@ -498,7 +497,7 @@ const runCommand = (opts, done) => {
throw new Error(`Unrecognized auth provider "${name}"`);
}
hz_instance.add_auth_provider(provider,
extend({ path: name }, opts.auth[name]));
Object.assign({}, { path: name }, opts.auth[name]));
}
}
}).catch(done);
Expand Down
7 changes: 3 additions & 4 deletions cli/test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ const processConfig = serve.processConfig;
const argparse = require('argparse');
const assert = require('assert');
const fs = require('fs');
const extend = require('util')._extend;

const arg_parser = new argparse.ArgumentParser();
serve.addArguments(arg_parser);

const make_flags = (flags) => extend(arg_parser.parseArgs([]), flags);
const make_flags = (flags) => Object.assign({}, arg_parser.parseArgs([]), flags);

const config_file = './test_config.toml';
const write_config = (config) => {
Expand Down Expand Up @@ -58,11 +57,11 @@ describe('Config', () => {
let original_env;

before('Save env', () => {
original_env = extend({}, process.env);
original_env = Object.assign({}, process.env);
});

afterEach('Restore env', () => {
process.env = extend({}, original_env);
process.env = Object.assign({}, original_env);
});

it('precedence', () => {
Expand Down
7 changes: 3 additions & 4 deletions server/src/auth/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const logger = require('../logger');

const cookie = require('cookie');
const crypto = require('crypto');
const extend = require('util')._extend;
const Joi = require('joi');
const url = require('url');

Expand All @@ -15,12 +14,12 @@ const do_redirect = (res, redirect_url) => {
};

const extend_url_query = (path, query) => {
const path_copy = extend({ }, path);
const path_copy = Object.assign({}, path);
if (path_copy.query === null) {
path_copy.query = query;
} else {
path_copy.query = extend({ }, path_copy.query);
path_copy.query = extend(path_copy.query, query);
path_copy.query = Object.assign({}, path_copy.query);
path_copy.query = Object.assign({}, path_copy.query, query);
}
return path_copy;
};
Expand Down
3 changes: 1 addition & 2 deletions server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const fs = require('fs');
const Joi = require('joi');
const url = require('url');
const websocket = require('ws');
const extend = require('util')._extend;

const protocol_name = 'rethinkdb-horizon-v0';

Expand Down Expand Up @@ -94,7 +93,7 @@ class Server {
verifyClient: verify_client };

const add_websocket = (server) => {
this._ws_servers.add(new websocket.Server(extend({ server }, ws_options))
this._ws_servers.add(new websocket.Server(Object.assign({}, { server }, ws_options))
.on('error', (error) => logger.error(`Websocket server error: ${error}`))
.on('connection', (socket) => new Client(socket, this)));
};
Expand Down
Loading

0 comments on commit da2c753

Please sign in to comment.