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 @@ -153,11 +153,6 @@ describe('Observer', function () {
153
153
var ob = Observer . create ( arr )
154
154
var dep = ob . dep
155
155
spyOn ( dep , 'notify' )
156
- // remove by index
157
- arr . $remove ( 0 )
158
- expect ( arr . length ) . toBe ( 1 )
159
- expect ( arr [ 0 ] ) . toBe ( obj2 )
160
- expect ( dep . notify . calls . count ( ) ) . toBe ( 1 )
161
156
// remove by identity, not in array
162
157
arr . $remove ( obj1 )
163
158
expect ( arr . length ) . toBe ( 1 )
You can’t perform that action at this time.
0 commit comments