@actualwave/call-if-function

Calls function and returns everything else

Usage no npm install needed!

<script type="module">
  import actualwaveCallIfFunction from 'https://cdn.skypack.dev/@actualwave/call-if-function';
</script>

README

@actualwave/call-if-function

callIfFunction accepts multiple arguments and checks first one. If it is a function, it will be called with other arguments passed to it(just like for Function.call()) If it is not a function, then value from first argument wil be returned.

I use it in react components, to check if component children are react nodes or a renderer function.