@@ -3,8 +3,7 @@ import {ascendingDefined, descendingDefined} from "../defined.js";
3
3
import { arrayify , isDomainSort , isOptions , maybeValue , valueof } from "../options.js" ;
4
4
5
5
/** @jsdoc transform */
6
- export function basic ( options = { } , transform ) {
7
- let { filter : f1 , sort : s1 , reverse : r1 , transform : t1 , initializer : i1 , ...remainingOptions } = options ;
6
+ export function basic ( { filter : f1 , sort : s1 , reverse : r1 , transform : t1 , initializer : i1 , ...options } = { } , transform ) {
8
7
// If both t1 and t2 are defined, returns a composite transform that first
9
8
// applies t1 and then applies t2.
10
9
if ( t1 === undefined ) {
@@ -15,15 +14,14 @@ export function basic(options = {}, transform) {
15
14
}
16
15
if ( transform != null && i1 != null ) throw new Error ( "transforms cannot be applied after initializers" ) ;
17
16
return {
18
- ...remainingOptions ,
17
+ ...options ,
19
18
...( ( s1 === null || isDomainSort ( s1 ) ) && { sort : s1 } ) ,
20
19
transform : composeTransform ( t1 , transform )
21
20
} ;
22
21
}
23
22
24
23
/** @jsdoc initializer */
25
- export function initializer ( options = { } , initializer ) {
26
- let { filter : f1 , sort : s1 , reverse : r1 , initializer : i1 , ...remainingOptions } = options ;
24
+ export function initializer ( { filter : f1 , sort : s1 , reverse : r1 , initializer : i1 , ...options } = { } , initializer ) {
27
25
// If both i1 and i2 are defined, returns a composite initializer that first
28
26
// applies i1 and then applies i2.
29
27
if ( i1 === undefined ) {
@@ -33,7 +31,7 @@ export function initializer(options = {}, initializer) {
33
31
if ( r1 ) i1 = composeInitializer ( i1 , reverseTransform ) ;
34
32
}
35
33
return {
36
- ...remainingOptions ,
34
+ ...options ,
37
35
...( ( s1 === null || isDomainSort ( s1 ) ) && { sort : s1 } ) ,
38
36
initializer : composeInitializer ( i1 , initializer )
39
37
} ;
0 commit comments