fix(facades): fix splice semantics; add test

This commit is contained in:
Yegor Jbanov
2015-04-17 13:20:03 -07:00
parent 2b4d30d931
commit 526c51d1a6
5 changed files with 24 additions and 4 deletions
+2 -1
View File
@@ -154,7 +154,8 @@ class ListWrapper {
static List slice(List l, int from, int to) {
return l.sublist(from, to);
}
static List splice(List l, int from, int to) {
static List splice(List l, int from, int length) {
var to = from + length;
var sub = l.sublist(from, to);
l.removeRange(from, to);
return sub;
+2 -2
View File
@@ -193,8 +193,8 @@ export class ListWrapper {
static slice(l:List, from:int, to:int):List {
return l.slice(from, to);
}
static splice(l:List, from:int, to:int):List {
return l.splice(from, to);
static splice(l:List, from:int, length:int):List {
return l.splice(from, length);
}
static sort(l:List, compareFn:Function) {
l.sort(compareFn);
@@ -168,6 +168,9 @@ export class ListWrapper {
return true;
}
static slice<T>(l: List<T>, from: int, to: int): List<T> { return l.slice(from, to); }
static splice<T>(l:List<T>, from:int, length:int):List<T> {
return l.splice(from, length);
}
static sort<T>(l: List<T>, compareFn: (a: T, b: T) => number) { l.sort(compareFn); }
}