You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.
As part of some validation requirements, I wanted to loop over subdomain labels, and since an array was the expected return of the getSubdomains() function, I assumed it would return an empty array if none were found.
Turns out it returns a null, meaning it broke any attempts to use it as the expected return type. I ended up working around this using a null coalescence like the following:
So, should this function return an empty array by default? I'd personally prefer if it did, since it keeps the return type consistent - but others might have differing opinions.
The text was updated successfully, but these errors were encountered:
As part of some validation requirements, I wanted to loop over subdomain labels, and since an array was the expected return of the
getSubdomains()
function, I assumed it would return an empty array if none were found.Turns out it returns a
null
, meaning it broke any attempts to use it as the expected return type. I ended up working around this using a null coalescence like the following:So, should this function return an empty array by default? I'd personally prefer if it did, since it keeps the return type consistent - but others might have differing opinions.
The text was updated successfully, but these errors were encountered: