@@ -47,42 +47,42 @@ export const arrayInstrumentations: Record<string | symbol, Function> = <any>{
47
47
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
48
48
thisArg ?: unknown ,
49
49
) {
50
- return apply ( this , 'every' , fn , thisArg )
50
+ return apply ( this , 'every' , fn , thisArg , undefined , arguments )
51
51
} ,
52
52
53
53
filter (
54
54
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
55
55
thisArg ?: unknown ,
56
56
) {
57
- return apply ( this , 'filter' , fn , thisArg , v => v . map ( toReactive ) )
57
+ return apply ( this , 'filter' , fn , thisArg , v => v . map ( toReactive ) , arguments )
58
58
} ,
59
59
60
60
find (
61
61
fn : ( item : unknown , index : number , array : unknown [ ] ) => boolean ,
62
62
thisArg ?: unknown ,
63
63
) {
64
- return apply ( this , 'find' , fn , thisArg , toReactive )
64
+ return apply ( this , 'find' , fn , thisArg , toReactive , arguments )
65
65
} ,
66
66
67
67
findIndex (
68
68
fn : ( item : unknown , index : number , array : unknown [ ] ) => boolean ,
69
69
thisArg ?: unknown ,
70
70
) {
71
- return apply ( this , 'findIndex' , fn , thisArg )
71
+ return apply ( this , 'findIndex' , fn , thisArg , undefined , arguments )
72
72
} ,
73
73
74
74
findLast (
75
75
fn : ( item : unknown , index : number , array : unknown [ ] ) => boolean ,
76
76
thisArg ?: unknown ,
77
77
) {
78
- return apply ( this , 'findLast' , fn , thisArg , toReactive )
78
+ return apply ( this , 'findLast' , fn , thisArg , toReactive , arguments )
79
79
} ,
80
80
81
81
findLastIndex (
82
82
fn : ( item : unknown , index : number , array : unknown [ ] ) => boolean ,
83
83
thisArg ?: unknown ,
84
84
) {
85
- return apply ( this , 'findLastIndex' , fn , thisArg )
85
+ return apply ( this , 'findLastIndex' , fn , thisArg , undefined , arguments )
86
86
} ,
87
87
88
88
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
@@ -91,7 +91,7 @@ export const arrayInstrumentations: Record<string | symbol, Function> = <any>{
91
91
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
92
92
thisArg ?: unknown ,
93
93
) {
94
- return apply ( this , 'forEach' , fn , thisArg )
94
+ return apply ( this , 'forEach' , fn , thisArg , undefined , arguments )
95
95
} ,
96
96
97
97
includes ( ...args : unknown [ ] ) {
@@ -116,7 +116,7 @@ export const arrayInstrumentations: Record<string | symbol, Function> = <any>{
116
116
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
117
117
thisArg ?: unknown ,
118
118
) {
119
- return apply ( this , 'map' , fn , thisArg )
119
+ return apply ( this , 'map' , fn , thisArg , undefined , arguments )
120
120
} ,
121
121
122
122
pop ( ) {
@@ -161,7 +161,7 @@ export const arrayInstrumentations: Record<string | symbol, Function> = <any>{
161
161
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
162
162
thisArg ?: unknown ,
163
163
) {
164
- return apply ( this , 'some' , fn , thisArg )
164
+ return apply ( this , 'some' , fn , thisArg , undefined , arguments )
165
165
} ,
166
166
167
167
splice ( ...args : unknown [ ] ) {
@@ -236,12 +236,13 @@ function apply(
236
236
fn : ( item : unknown , index : number , array : unknown [ ] ) => unknown ,
237
237
thisArg ?: unknown ,
238
238
wrappedRetFn ?: ( result : any ) => unknown ,
239
+ args ?: IArguments ,
239
240
) {
240
241
const arr = shallowReadArray ( self )
241
242
let methodFn
242
243
// @ts -expect-error our code is limited to es2016 but user code is not
243
244
if ( ( methodFn = arr [ method ] ) !== arrayProto [ method ] ) {
244
- return methodFn . apply ( arr , arrayProto . slice . call ( arguments , 2 ) )
245
+ return methodFn . apply ( arr , args )
245
246
}
246
247
247
248
let needsWrap = false
0 commit comments