Add erase function (#2641)

This commit is contained in:
Aya Morisawa
2018-09-07 00:02:55 +09:00
committed by syuilo
parent 3cace734c7
commit 00d79487cd
11 changed files with 31 additions and 19 deletions

View File

@ -13,3 +13,7 @@ export function concat<T>(xss: T[][]): T[] {
export function intersperse<T>(sep: T, xs: T[]): T[] {
return concat(xs.map(x => [sep, x])).slice(1);
}
export function erase<T>(x: T, xs: T[]): T[] {
return xs.filter(y => x !== y);
}