You are only using the above variables once.

Might not be worth caching them, and just checking against the stripUnique calls in the if?

Not sure, though, what do you think?