File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change
1
+ # 1.0.7 / 2016-12-11
2
+
3
+ * Early return for rejected promise
4
+ * Prevent promsie swallow in callback
5
+
1
6
# 1.0.6 / 2016-11-29
2
7
3
8
* Bump version for new Repo
Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ module.exports = function() {
7
7
8
8
const promise = new Promise ( ( resolve , reject ) => {
9
9
if ( ! args . length ) {
10
- reject ( 'wrong number of arguments' ) ;
10
+ return reject ( 'wrong number of arguments' ) ;
11
11
}
12
12
13
13
const port = parseInt ( args [ 0 ] , 10 ) ;
14
14
15
15
if ( isNaN ( port ) ) {
16
- reject ( `wrong type of arguments with: '${ args [ 0 ] } '` ) ;
16
+ return reject ( `wrong type of arguments with: '${ args [ 0 ] } '` ) ;
17
17
}
18
18
19
19
const loop = port => {
@@ -63,9 +63,9 @@ module.exports = function() {
63
63
const cb = args [ 1 ] ;
64
64
65
65
promise . then ( data => {
66
- cb . call ( this , null , data ) ;
67
- } ) . catch ( err => {
68
- cb . call ( this , err ) ;
66
+ process . nextTick ( cb . bind ( null , null , data ) ) ;
67
+ } , err => {
68
+ process . nextTick ( cb . bind ( null , err ) ) ;
69
69
} ) ;
70
70
} else {
71
71
return promise ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " detect-port" ,
3
- "version" : " 1.0.6 " ,
3
+ "version" : " 1.0.7 " ,
4
4
"description" : " detect available port" ,
5
5
"keywords" : [
6
6
" detect" ,
You can’t perform that action at this time.
0 commit comments