async-listener
Advanced tools
Comparing version 0.4.2 to 0.4.3
29
index.js
@@ -33,2 +33,31 @@ 'use strict'; | ||
var net = require('net'); | ||
// a polyfill in our polyfill etc so forth -- taken from node master on 2013/10/30 | ||
if (!net._normalizeConnectArgs) { | ||
net._normalizeConnectArgs = function (args) { | ||
var options = {}; | ||
function toNumber(x) { return (x = Number(x)) >= 0 ? x : false; } | ||
if (typeof args[0] === 'object' && args[0] !== null) { | ||
// connect(options, [cb]) | ||
options = args[0]; | ||
} | ||
else if (typeof args[0] === 'string' && toNumber(args[0]) === false) { | ||
// connect(path, [cb]); | ||
options.path = args[0]; | ||
} | ||
else { | ||
// connect(port, [host], [cb]) | ||
options.port = args[0]; | ||
if (typeof args[1] === 'string') { | ||
options.host = args[1]; | ||
} | ||
} | ||
var cb = args[args.length - 1]; | ||
return typeof cb === 'function' ? [options, cb] : [options]; | ||
}; | ||
} | ||
wrap(net.Server.prototype, '_listen2', function (original) { | ||
@@ -35,0 +64,0 @@ return function () { |
{ | ||
"name": "async-listener", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Polyfill exporting trevnorris's 0.11+ asyncListener API.", | ||
@@ -5,0 +5,0 @@ "author": "Forrest L Norvell <ogd@aoaioxxysz.net>", |
@@ -0,1 +1,3 @@ | ||
[![NPM](https://nodei.co/npm/async-listener.png?downloads=true&stars=true)](https://nodei.co/npm/async-listener/) | ||
# process.addAsyncListener polyfill | ||
@@ -2,0 +4,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72384
2104
58