File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,8 @@ export default class ParsePromise {
346
346
*/
347
347
static when ( promises ) {
348
348
var objects ;
349
- if ( Array . isArray ( promises ) ) {
349
+ var arrayArgument = Array . isArray ( promises ) ;
350
+ if ( arrayArgument ) {
350
351
objects = promises ;
351
352
} else {
352
353
objects = arguments ;
@@ -355,12 +356,13 @@ export default class ParsePromise {
355
356
var total = objects . length ;
356
357
var hadError = false ;
357
358
var results = [ ] ;
359
+ var returnValue = arrayArgument ? [ results ] : results ;
358
360
var errors = [ ] ;
359
361
results . length = objects . length ;
360
362
errors . length = objects . length ;
361
363
362
364
if ( total === 0 ) {
363
- return ParsePromise . as . apply ( this , results ) ;
365
+ return ParsePromise . as . apply ( this , returnValue ) ;
364
366
}
365
367
366
368
var promise = new ParsePromise ( ) ;
@@ -371,7 +373,7 @@ export default class ParsePromise {
371
373
if ( hadError ) {
372
374
promise . reject ( errors ) ;
373
375
} else {
374
- promise . resolve . apply ( promise , results ) ;
376
+ promise . resolve . apply ( promise , returnValue ) ;
375
377
}
376
378
}
377
379
} ;
You can’t perform that action at this time.
0 commit comments