File tree 2 files changed +4
-6
lines changed 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,7 @@ import { expectMatchingValues } from './expectMatchingValues';
8
8
export function expectEqualPromisesOrValues < T > (
9
9
items : ReadonlyArray < PromiseOrValue < T > > ,
10
10
) : PromiseOrValue < T > {
11
- const remainingItems = items . slice ( ) ;
12
- const firstItem = remainingItems . shift ( ) ;
13
-
11
+ const [ firstItem , ...remainingItems ] = items ;
14
12
if ( isPromise ( firstItem ) ) {
15
13
if ( remainingItems . every ( isPromise ) ) {
16
14
return Promise . all ( items ) . then ( expectMatchingValues ) ;
Original file line number Diff line number Diff line change 1
1
import { expectJSON } from './expectJSON' ;
2
2
3
3
export function expectMatchingValues < T > ( values : ReadonlyArray < T > ) : T {
4
- const remainingValues = values . slice ( 1 ) ;
4
+ const [ firstValue , ... remainingValues ] = values ;
5
5
for ( const value of remainingValues ) {
6
- expectJSON ( value ) . toDeepEqual ( values [ 0 ] ) ;
6
+ expectJSON ( value ) . toDeepEqual ( firstValue ) ;
7
7
}
8
- return values [ 0 ] ;
8
+ return firstValue ;
9
9
}
You can’t perform that action at this time.
0 commit comments