left-pad-logarithmic

1.0.5 • Public • Published

Summary

String left pad.

This behaves exactly like the famed left-pad, but it runs in O(lg n). Useful for left-padding in larger, web-scale situations.

Install

$ npm install left-pad-logarithmic

Usage

leftpad = require('left-pad-logarithmic')

leftpad('foo', 5)
// => "  foo"

leftpad('foobar', 6)
// => "foobar"

leftpad(1, 2, 0)
// => "01"

leftpad('foo', 15)
// => "            foo"

Package Sidebar

Install

npm i left-pad-logarithmic

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • drshaffopolis