Skip to content

Instantly share code, notes, and snippets.

@nickpresta
Created April 30, 2015 15:12
Show Gist options
  • Save nickpresta/e61dec7fbca5cbf843dd to your computer and use it in GitHub Desktop.
Save nickpresta/e61dec7fbca5cbf843dd to your computer and use it in GitHub Desktop.
Lodash string methods vs underscore.string vs other languages
// Lodash
_.padRight('', 5, 'x'); // === ''
// underscore.string
s.rpad('', 5, 'x'); // === 'xxxxx'
// Python
'{:x<5}'.format('') # == 'xxxxx'
// Ruby
''.rjust(5, 'x') # "xxxxx"
@nickpresta
Copy link
Author

I realize this may be intentional but it seems strange. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment