Skip to content

Commit

Permalink
Add comments related to PR #129
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Dec 21, 2017
1 parent 0d62bcc commit 13fe071
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,18 @@ function patchOnRead(ctx) {
wrap(net.Socket.prototype, 'connect', function (original) {
return function () {
var args;
// Node core uses an internal Symbol here to guard against the edge-case
// where the user accidentally passes in an array. As we don't have access
// to this Symbol we resort to this hack where we just detect if there is a
// symbol or not. Checking for the number of Symbols is by no means a fool
// proof solution, but it catches the most basic cases.
if (v8plus &&
Array.isArray(arguments[0]) &&
Object.getOwnPropertySymbols(arguments[0]).length > 0) {
// already normalized
args = arguments[0];
} else {
// From Node.js v7.0.0, net._normalizeConnectArgs have been renamed net._normalizeArgs
// From Node.js v7.0.0, net._normalizeConnectArgs have been renamed net._normalizeArgs
args = v7plus
? net._normalizeArgs(arguments)
: net._normalizeConnectArgs(arguments);
Expand Down

0 comments on commit 13fe071

Please sign in to comment.