Pristine
Pristine copied to clipboard
isFunction helper
Why do you use this helper?
export function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
}
Why not just typeof func === 'function'?
typeof Object, typeof Date, and typeof String, etc all return 'function'
Yes, them do... but that's because all of them are functions. And that's why ever the isFunction helper also says that them are functions
function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
}
undefined
isFunction(Object)
true
isFunction(String)
true
isFunction(Date)
true

Hi @psmyrdek, could you please have a look since this function was added by you? :)