perf(util): call toLowerCase() only where needed

And do not call split for empty string