Package Exports
- stringpad
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stringpad) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
stringpad
A repository for npm module stringpad inspired by Azar's Leftpad (which recently broke the internet), with performance improvements and Rightpad and Centerpad option too.
Implemented algorithm used for Javascript's repeat. Probably the fastest implementation of Azar's Leftpad, with added options.
Run tests using:
node test
Usage:
stringpad.left('foo', 5)' foo'
stringpad.left('foobar', 6)'foobar'
stringpad.left(1, 2, 0)'01'
stringpad.left(1, 2, '-')'-1'
stringpad.right('foo', 5)'foo '
stringpad.right('foobar', 6)'foobar'
stringpad.right(1, 2, 0)'10'
stringpad.right(1, 2, '-')'1-'
stringpad.center('foo', 5)' foo '
stringpad.center('foo', 6, '-')'---foo---'