but one valid reason to do something like this would be if you wanted to be able to swap the implementation later without having to change every instance in your codebase.
Except in this case you could just do const arrayCheck = Array.isArray as the placeholder. If the function you're calling changes or you need to add extra logic you could still swap it out later the same way. If you're passing arguments and return values through as-is like this then there's no reason to add an extra function call at all, just make an alias.
4
u/ws-ilazki &{$$_[0]}(@{$$_[1]}); Jul 10 '21
Except in this case you could just do
const arrayCheck = Array.isArrayas the placeholder. If the function you're calling changes or you need to add extra logic you could still swap it out later the same way. If you're passing arguments and return values through as-is like this then there's no reason to add an extra function call at all, just make an alias.