3 ms·
It had been optimized (and deprecated) since then. See https://github.com/left-pad/left-pad/blob/master/index.js https://github.com/left-pad/left-pad/blob/maste
by jonathrg 5y ago
It had been optimized (and deprecated) since then. See https://github.com/left-pad/left-pad/blob/master/index.js https://github.com/left-pad/left-pad/blob/master/index.js
- deleted 5y ago[deleted]
- ghj 5y agoI've commented about this before, but their supposedly optimized implementation is still garbage: https://news.ycombinator.com/item?id=24125312 https://news.ycombinator.com/item?id=24125312 There's no reason to build the repeats up by doubling since the string concatenation of two same string is still linear time.