File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,10 @@ _.define(
83
83
_ . define (
84
84
arrayProto ,
85
85
'$remove' ,
86
- function $remove ( index ) {
86
+ function $remove ( item ) {
87
87
/* istanbul ignore if */
88
88
if ( ! this . length ) return
89
- if ( typeof index !== 'number' ) {
90
- index = _ . indexOf ( this , index )
91
- }
89
+ var index = _ . indexOf ( this , item )
92
90
if ( index > - 1 ) {
93
91
return this . splice ( index , 1 )
94
92
}
Original file line number Diff line number Diff line change @@ -157,11 +157,6 @@ describe('Observer', function () {
157
157
var ob = Observer . create ( arr )
158
158
var dep = ob . dep
159
159
spyOn ( dep , 'notify' )
160
- // remove by index
161
- arr . $remove ( 0 )
162
- expect ( arr . length ) . toBe ( 1 )
163
- expect ( arr [ 0 ] ) . toBe ( obj2 )
164
- expect ( dep . notify . calls . count ( ) ) . toBe ( 1 )
165
160
// remove by identity, not in array
166
161
arr . $remove ( obj1 )
167
162
expect ( arr . length ) . toBe ( 1 )
You can’t perform that action at this time.
0 commit comments