3 ms·
The fact that there was a need for the left-pad module is pretty telling on how comprehensive the stdlib in js is.
by Doxin 9y ago
The fact that there was a need for the left-pad module is pretty telling on how comprehensive the stdlib in js is.
- Thiez 9y agoWhich programming language are you using that has left-pads functionality in the standard library?
- mort96 9y agoWell, python's strings have the ljust and rjust methods which left- and right-pad, and javascript has the padStart and padEnd methods (since ECMAScript 2017).
- scarface74 9y ago.Net https://msdn.microsoft.com/en-us/library/system.string.padleft(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.string.padle...
- mort96 9y agoI wasn't really interested in your opinion based on the lack of one 1-line utility function (and it is one line: `new Array(10 - str.length).fill("0").join("") + str`). I was interested in what significant functionality OP found lacking in node.js' standard library.