From 211cb12413f292b2a44261c10f9864028e2e2e12 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Thu, 22 Jan 2015 09:41:26 +0100 Subject: [PATCH] fix(ListWrapper): fix JS ListWrapper.remove() --- modules/facade/src/collection.dart | 4 +--- modules/facade/src/collection.es6 | 10 +++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/facade/src/collection.dart b/modules/facade/src/collection.dart index 4ec9eecbad..4557fedf41 100644 --- a/modules/facade/src/collection.dart +++ b/modules/facade/src/collection.dart @@ -101,9 +101,7 @@ class ListWrapper { list.remove(items[i]); } } - static remove(List list, item) { - list.remove(item); - } + static bool remove(List list, item) => list.remove(item); static void clear(List l) { l.clear(); } static String join(List l, String s) => l.join(s); static bool isEmpty(list) => list.isEmpty; diff --git a/modules/facade/src/collection.es6 b/modules/facade/src/collection.es6 index 4f37a5c1ee..49ebc0b088 100644 --- a/modules/facade/src/collection.es6 +++ b/modules/facade/src/collection.es6 @@ -149,9 +149,13 @@ export class ListWrapper { list.splice(index, 1); } } - static remove(list, item) { - var index = list.indexOf(item); - list.splice(index, 1); + static remove(list, el): boolean { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; } static clear(list) { list.splice(0, list.length);