1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00

chore: compose history middleware

This commit is contained in:
2020-03-27 00:49:23 +09:00
parent bf39c3293f
commit d313dbd680
5 changed files with 28 additions and 10 deletions

View File

@@ -19,3 +19,7 @@ export function fillArray<T>(array: T[], filler: string, maximum: number): T[] {
}
return array;
}
export function compose<T>(arg: T, ...fn: ((arg: T) => T)[]): T {
return fn.reduce((arg, f) => f(arg), arg);
}