diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-09-06 21:31:15 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2018-09-06 21:31:15 +0900 |
| commit | 3cace734c70c752c57ed9a0057aef4d7ef788528 (patch) | |
| tree | dc4a339a826b6849646c9ab5086ab3fdccf8361d /src/prelude/array.ts | |
| parent | Refactor effects function (#2639) (diff) | |
| download | sharkey-3cace734c70c752c57ed9a0057aef4d7ef788528.tar.gz sharkey-3cace734c70c752c57ed9a0057aef4d7ef788528.tar.bz2 sharkey-3cace734c70c752c57ed9a0057aef4d7ef788528.zip | |
Add concat function (#2640)
Diffstat (limited to 'src/prelude/array.ts')
| -rw-r--r-- | src/prelude/array.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/prelude/array.ts b/src/prelude/array.ts index aee17640ed..9a3c266d6d 100644 --- a/src/prelude/array.ts +++ b/src/prelude/array.ts @@ -6,6 +6,10 @@ export function count<T>(x: T, xs: T[]): number { return countIf(y => x === y, xs); } +export function concat<T>(xss: T[][]): T[] { + return ([] as T[]).concat(...xss); +} + export function intersperse<T>(sep: T, xs: T[]): T[] { - return [].concat(...xs.map(x => [sep, x])).slice(1); + return concat(xs.map(x => [sep, x])).slice(1); } |