The wrap
function from Lodash creates a function that wraps func
to enable currying.
Here's an example of how to use it:
index.tsx125 chars6 lines
In this example, wrap
is used to create a function wrapped
that takes a function func
as its argument, and returns a new function that takes a second argument x
, applies func
to x
, and returns the result. In this case, we're passing Math.sqrt
as the func
argument to wrapped
, and then calling wrapped(25)
to apply Math.sqrt
to the value 25
.
Hope this helps!
gistlibby LogSnag