Maps a collection of things that may be functions over a value. Like over, but allows for the possibility that some things in the collection are not functions.
$ npm install @f/maybe-over
Example, a hover component:
var maybeOver = require('@f/maybe-over')
function render ({children, state}) {
children = maybeOver(state.hovering, children)
return (
<span>
{
maybeOver(state.hovering, children)
}
</span>
)
}
value
- The value you want to call the functions inmaybeFns
withmaybeFns
- A list of items. If the value in the list is a function, it will be executed withvalue
as its first argument.
Returns: The result of executing all the functions in maybeFns
on value
, and just returning the other values in maybeFns
.
MIT