Commit 1fdae3a5 by Vladislav Lagunov

Исправлен баг в порядке функций в ~/functions/compose

parent 469d3ed0
......@@ -6,5 +6,5 @@ export default function compose<A, B, C>(f: (a: A) => B, g: (b: B) => C): (a: A)
export default function compose<A, B, C, D>(f: (a: A) => B, g: (b: B) => C, h: (c: C) => D): (a: A) => D;
export default function compose<A, B, C, D, E>(f: (a: A) => B, g: (b: B) => C, h: (c: C) => D, j: (d: D) => E): (a: A) => E;
export default function compose(...funcs: Function[]): Function {
return a => funcs.reduce((acc, f) => f(acc), a);
return a => funcs.reduceRight((acc, f) => f(acc), a);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment