Skip to content

Commit 211cb12

Browse files
committed
fix(ListWrapper): fix JS ListWrapper.remove()
1 parent 8612af9 commit 211cb12

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

modules/facade/src/collection.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ class ListWrapper {
101101
list.remove(items[i]);
102102
}
103103
}
104-
static remove(List list, item) {
105-
list.remove(item);
106-
}
104+
static bool remove(List list, item) => list.remove(item);
107105
static void clear(List l) { l.clear(); }
108106
static String join(List l, String s) => l.join(s);
109107
static bool isEmpty(list) => list.isEmpty;

modules/facade/src/collection.es6

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ export class ListWrapper {
149149
list.splice(index, 1);
150150
}
151151
}
152-
static remove(list, item) {
153-
var index = list.indexOf(item);
154-
list.splice(index, 1);
152+
static remove(list, el): boolean {
153+
var index = list.indexOf(el);
154+
if (index > -1) {
155+
list.splice(index, 1);
156+
return true;
157+
}
158+
return false;
155159
}
156160
static clear(list) {
157161
list.splice(0, list.length);

0 commit comments

Comments
 (0)