withIt
withIt(input, function(){ // do something here with this })
The context object is available as a receiver (this).
The return value is the lambda result.
As withIt is not an extension function: the context object is passed as an argument, but inside the lambda, it's available as a receiver (this).
We recommend using withIt for calling functions on the context object when you don't need to use the returned result. In code, with can be read as "with this object, do the following."
You can also use withIt to introduce a helper object whose properties or functions are used for calculating a value.
Last updated