Skip to content

Instantly share code, notes, and snippets.

@uiteoi
Created March 31, 2016 21:07
Show Gist options
  • Save uiteoi/09c60d9b508ad117fcbf4290b9f9f7b7 to your computer and use it in GitHub Desktop.
Save uiteoi/09c60d9b508ad117fcbf4290b9f9f7b7 to your computer and use it in GitHub Desktop.
leftpad( s, len, c )
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