jonschlinkert / repeat-string

Repeat the given string n times. Fastest implementation for repeating a string (2x faster than the native method)
https://github.com/jonschlinkert
MIT License
49 stars 17 forks source link

use switch (num) to cover more common cases and improve perf #9

Open jedwards1211 opened 4 years ago

jedwards1211 commented 4 years ago

Just an idea, I don't know if there are any ramifications to this, but according to my jsperf test this is 58% faster for num <= 5 👍