Copy & paste mistake

On line 129 you're checking t1 for a typeof "string" but modifying v2 value which is likely a mistake, though not significant since t1 == t2.