I'm not sure if this has been proposed before, if not I would like to
propose a native way to handle function composition.

This is not that trivial, it can be achieved via a generic utility however
considering this is quite a common pattern it might make sense to include
it as a native feature set

Something along the lines of

Function.prototype.compose(); // chained at end of callstack

Function.prototype.composeBefore();


This could* A) *return a new function* B) *chain from the original reference

Quite often composition is not limited to a single function so it could be
a better approach to allow multiple arguments to be chained

Could also follow a similar design as the Java implementation
<https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html#compose-java.util.function.Function->

Regards,
Simon Staton
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to