From 00d79487cd89f3cae675ecc0392c47ba547b69a5 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 7 Sep 2018 00:02:55 +0900 Subject: Add erase function (#2641) --- src/prelude/array.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/prelude/array.ts') diff --git a/src/prelude/array.ts b/src/prelude/array.ts index 9a3c266d6d..a2a6bbd4c6 100644 --- a/src/prelude/array.ts +++ b/src/prelude/array.ts @@ -13,3 +13,7 @@ export function concat(xss: T[][]): T[] { export function intersperse(sep: T, xs: T[]): T[] { return concat(xs.map(x => [sep, x])).slice(1); } + +export function erase(x: T, xs: T[]): T[] { + return xs.filter(y => x !== y); +} -- cgit v1.2.3-freya