Extension methods for functions with arity 1 (functions that take exactly 1 argument).

Static methods

staticinlinecompose<TIn, TRet1, TRet2>(fa:TRet2 ‑> TRet1, fb:TIn ‑> TRet2):TIn ‑> TRet1

compose returns a function that calls the first argument function with the result of the following one.

staticinlinecontramap<A, B, C>(fbc:B ‑> C, fab:A ‑> B):A ‑> C

The contravariant functor for Function1<_, B>. Equivalent to compose.

staticfn<T, T2>(fn:T ‑> T2, restArgs:Dynamic):Dynamic

Lambda expressions

staticinlinejoin<TIn>(fa:TIn ‑> Void, fb:TIn ‑> Void):(v:TIn) ‑> Void

join creates a function that calls the 2 functions passed as arguments in sequence and passes the same argument value to the both of them.

staticinlinemap<A, B, C>(fab:A ‑> B, fbc:B ‑> C):A ‑> C

The covariant functor for Function1

staticmemoize<TIn, TOut>(callback:TIn ‑> TOut, ?resolver:TIn ‑> String):TIn ‑> TOut

memoize wraps callback and calls it only once storing the result for future needs.

Computed results are stored in an internal map. The keys to this map are generated by the resolver function that by default directly converts the first argument into a string.

staticinlinenegate<T1>(callback:T1 ‑> Bool):(v:T1) ‑> Bool

Wraps callback in a function that negates its results.

staticnoop<T>(_:T):Void

noop is a function that has no side effects and doesn't return any value.

staticinlineswapArguments<T1, T2, TReturn>(callback:(T1, T2) ‑> TReturn):(T2, T1) ‑> TReturn

Returns a function that behaves the same as callback but has its arguments inverted.

staticinlinetimes<TIn, TOut>(n:Int, callback:TIn ‑> TOut):(value:TIn) ‑> Array<TOut>

Creates a function that calls callback n times and returns an array of results.

staticinlinetimesi<TIn, TOut>(n:Int, callback:(TIn, Int) ‑> TOut):(value:TIn) ‑> Array<TOut>

Creates a function that calls callback n times and returns an array of results.

Callback takes an additional argument index.