Cleaner extension split and fix for redundant ext null check

Nothing major. I changed the .slice(-1)[0] to .pop(), it seems cleaner. 

Also, the variable ext is checked === null, which is never the case as it is always set to be some string. I've changed the conditional check so null will be returned if ext was empty. The conditional check can be removed completely to retain the current behavior: empty string when no extension is present.