Hacker News new | ask | show | jobs
by devit 1896 days ago
The latter change introduces an unnecessary clone(). The correct approach is to instead introduce a variable so that headerRegex can keep being a reference to either that variable or to HEADER_REGEX.
1 comments

Can you expand on how this stops a clone from happening?
If you don't call clone() then a clone doesn't happen...
Ah, I didn't see the extra clone. I thought it was something to do with that additional variable you defined. I guess you need to do that or else you have to do a clone.