File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " promise-polyfill" ,
3
- "version" : " 8.1.1 " ,
3
+ "version" : " 8.1.2 " ,
4
4
"description" : " Lightweight promise polyfill. A+ compliant" ,
5
5
"main" : " lib/index.js" ,
6
6
"module" : " src/index.js" ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import promiseFinally from './finally';
5
5
var setTimeoutFunc = setTimeout ;
6
6
7
7
function isArray ( x ) {
8
- return Boolean ( x && x . length ) ;
8
+ return Boolean ( x && typeof x . length !== 'undefined' ) ;
9
9
}
10
10
11
11
function noop ( ) { }
Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ describe('Promise', function() {
373
373
}
374
374
) ;
375
375
} ) ;
376
- it ( 'throws on multiple promises' , function ( ) {
376
+ it ( 'works on multiple resolved promises' , function ( ) {
377
377
return Promise . all ( [ Promise . resolve ( ) , Promise . resolve ( ) ] ) . then (
378
378
function ( ) {
379
379
assert . ok ( true ) ;
@@ -383,6 +383,16 @@ describe('Promise', function() {
383
383
}
384
384
) ;
385
385
} ) ;
386
+ it ( 'works on empty array' , function ( ) {
387
+ return Promise . all ( [ ] ) . then (
388
+ function ( arr ) {
389
+ assert . ok ( arr . length === 0 ) ;
390
+ } ,
391
+ function ( ) {
392
+ assert . fail ( ) ;
393
+ }
394
+ ) ;
395
+ } ) ;
386
396
} ) ;
387
397
describe ( 'Promise.race' , function ( ) {
388
398
it ( 'throws on implicit undefined' , function ( ) {
@@ -499,5 +509,9 @@ describe('Promise', function() {
499
509
}
500
510
) ;
501
511
} ) ;
512
+ it ( 'works on empty array' , function ( ) {
513
+ var prom = Promise . race ( [ ] ) ;
514
+ return assert ( prom instanceof Promise ) ;
515
+ } ) ;
502
516
} ) ;
503
517
} ) ;
You can’t perform that action at this time.
0 commit comments