Created
March 31, 2016 21:07
-
-
Save uiteoi/09c60d9b508ad117fcbf4290b9f9f7b7 to your computer and use it in GitHub Desktop.
leftpad( s, len, c )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = leftpad; | |
function leftpad( s, len, c ) { | |
s = s == null ? "" : String( s ); | |
return Array( len - s.length + 1 ).join( c || c === 0 ? c : " " ) + s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment