Skip to content

Commit

Permalink
utils/util: reorganize functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Aug 6, 2017
1 parent 422d2d4 commit cc1462f
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 143 deletions.
3 changes: 1 addition & 2 deletions lib/http/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,7 @@ HTTPBaseOptions.prototype.fromOptions = function fromOptions(options) {
}

if (options.port != null) {
assert(typeof options.port === 'number', 'Port must be a number.');
assert(options.port > 0 && options.port <= 0xffff);
assert(util.isU16(options.port), 'Port must be a number.');
this.port = options.port;
}

Expand Down
3 changes: 1 addition & 2 deletions lib/http/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,7 @@ HTTPOptions.prototype.fromOptions = function fromOptions(options) {
}

if (options.port != null) {
assert(typeof options.port === 'number', 'Port must be a number.');
assert(options.port > 0 && options.port <= 0xffff);
assert(util.isU16(options.port), 'Port must be a number.');
this.port = options.port;
}

Expand Down
6 changes: 2 additions & 4 deletions lib/net/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -3726,8 +3726,7 @@ PoolOptions.prototype.fromOptions = function fromOptions(options) {
}

if (options.port != null) {
assert(typeof options.port === 'number');
assert(options.port > 0 && options.port <= 0xffff);
assert(util.isU16(options.port));
this.port = options.port;
this.publicPort = options.port;
}
Expand All @@ -3738,8 +3737,7 @@ PoolOptions.prototype.fromOptions = function fromOptions(options) {
}

if (options.publicPort != null) {
assert(typeof options.publicPort === 'number');
assert(options.publicPort > 0 && options.publicPort <= 0xffff);
assert(util.isU16(options.publicPort));
this.publicPort = options.publicPort;
}

Expand Down
Loading

0 comments on commit cc1462f

Please sign in to comment.