Skip to content

Commit

Permalink
Changed the options object for createMaster() to be entirely optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
morkai committed Jul 16, 2013
1 parent 18aba85 commit 0218e8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/concise-init-tcp-ip-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var modbus = require('../lib');

var master = modbus.createMaster({});
var master = modbus.createMaster();

master.once('connected', function()
{
Expand Down
9 changes: 7 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ function createTransport(options)
}

/**
* @param {object} options
* @param {object} options.transport
* @param {object} [options]
* @param {object} [options.transport]
* @param {boolean} [options.retryOnException]
* @param {number} [options.maxConcurrentRequests]
* @param {number} [options.defaultUnit]
Expand All @@ -120,6 +120,11 @@ function createTransport(options)
*/
function createMaster(options)
{
if (typeof options === 'undefined')
{
options = {};
}

options.transport = createTransport(options.transport);
options = new Master.Options(options);

Expand Down

0 comments on commit 0218e8e

Please sign in to comment.