Skip to content

Commit 1aa5ebd

Browse files
authored
Merge pull request #160 from MasterOdin/chore-promises
Remove check for promise support
2 parents de656d7 + d773298 commit 1aa5ebd

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ portfinder.getPort(function (err, port) {
2424
});
2525
```
2626

27-
Or with promise (if `Promise`s are supported) :
27+
Or using promises:
2828

2929
``` js
3030
const portfinder = require('portfinder');
@@ -43,8 +43,6 @@ portfinder.getPortPromise()
4343
});
4444
```
4545

46-
If `portfinder.getPortPromise()` is called on a Node version without Promise (<4), it will throw an Error unless [Bluebird](http://bluebirdjs.com/docs/getting-started.html) or any Promise pollyfill is used.
47-
4846
### Ports search scope
4947

5048
By default `portfinder` will start searching from `8000` and scan until maximum port number (`65535`) is reached.

lib/portfinder.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ exports.getPort = function (options, callback) {
226226
// Responds a promise to an unbound port on the current machine.
227227
//
228228
exports.getPortPromise = function (options) {
229-
if (typeof Promise !== 'function') {
230-
throw Error('Native promise support is not available in this version of node.' +
231-
'Please install a polyfill and assign Promise to global.Promise before calling this method');
232-
}
233229
if (!options) {
234230
options = {};
235231
}
@@ -280,10 +276,6 @@ exports.getPorts = function (count, options, callback) {
280276
// Responds with a promise that resolves to an array of unbound ports on the current machine.
281277
//
282278
exports.getPortsPromise = function (count, options) {
283-
if (typeof Promise !== 'function') {
284-
throw Error('Native promise support is not available in this version of node.' +
285-
'Please install a polyfill and assign Promise to global.Promise before calling this method');
286-
}
287279
if (!options) {
288280
options = {};
289281
}

0 commit comments

Comments
 (0)