refactor: prefer early return to conditional
refactor: prefer early return to conditional

This commit has to function return early if domain is undefined or null
instead of using a ternary at the end of the function. This avoids
unnecessary calls to regexes and saves computation time.

frederickfogerty/react-imgix,frederickfogerty/react-imgix