fix(ListWrapper): fix JS ListWrapper.remove()

This commit is contained in:
Victor Berchet 2015-01-22 09:41:26 +01:00
parent 8612af9c50
commit 211cb12413
2 changed files with 8 additions and 6 deletions

View File

@ -101,9 +101,7 @@ class ListWrapper {
list.remove(items[i]); list.remove(items[i]);
} }
} }
static remove(List list, item) { static bool remove(List list, item) => list.remove(item);
list.remove(item);
}
static void clear(List l) { l.clear(); } static void clear(List l) { l.clear(); }
static String join(List l, String s) => l.join(s); static String join(List l, String s) => l.join(s);
static bool isEmpty(list) => list.isEmpty; static bool isEmpty(list) => list.isEmpty;

View File

@ -149,9 +149,13 @@ export class ListWrapper {
list.splice(index, 1); list.splice(index, 1);
} }
} }
static remove(list, item) { static remove(list, el): boolean {
var index = list.indexOf(item); var index = list.indexOf(el);
list.splice(index, 1); if (index > -1) {
list.splice(index, 1);
return true;
}
return false;
} }
static clear(list) { static clear(list) {
list.splice(0, list.length); list.splice(0, list.length);