If you have a string, and try to use some of the default string methods (like toUpperCase, toLowerCase, etc).
If the string is '' (empty) calling these methods will fail with error 'No access to method', because of the check in isSafeMethod function.
if (!object || typeof object[method] !== 'function') {
return false;
}
!'' is always true. But '' is a legit string.
!object should be replaced with condition !== null && !== undefined
If you have a string, and try to use some of the default string methods (like toUpperCase, toLowerCase, etc).
If the string is '' (empty) calling these methods will fail with error 'No access to method', because of the check in isSafeMethod function.
!'' is always true. But '' is a legit string.
!object should be replaced with condition !== null && !== undefined