lib: make callback checks more strict
Many places in lib/
check if a callback argument is truthy before using the callback. This doesn't make any guarantees that the callback is actually a function though. This commit replaces truthy checks with explicit typeof
checks.
FWIW, my personal opinion is that we should throw in the cases where the callback is not a function, but people might find that too disruptive.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows [commit guidelines][]
Affected core subsystem(s)
lib