mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 13:41:40 +00:00
update
This commit is contained in:
19
node_modules/portscanner/lib/promisify.js
generated
vendored
Normal file
19
node_modules/portscanner/lib/promisify.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
module.exports = promisify
|
||||
|
||||
function promisify (fn, args) {
|
||||
if (typeof Promise === 'undefined') {
|
||||
throw new Error('Please run in a Promise supported environment or provide a callback')
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
args = [].slice.call(args).concat([callback])
|
||||
fn.apply(null, args)
|
||||
|
||||
function callback (error, port) {
|
||||
if (error || port === false) {
|
||||
reject(error || new Error('No open port found'))
|
||||
} else {
|
||||
resolve(port)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user