node-string-pad

0.0.4 • Public • Published

node-string-pad is a simple function to pad strings. Original code from http://www.webtoolkit.info/, modified by me as node.js module with better arguments input.

Installing

npm install node-string-pad

Usage

var pad = require('node-string-pad');

var padded_string = pad(string, len, [direction, character]);

Default: pad RIGHT using ' '.

pad('pad', 7).should.equal('pad    ');

Direction can be 'RIGHT' or 'LEFT' or 'BOTH', though 'RIGHT' can be omitted.

pad('pad', 7, '_').should.equal('pad____');
pad('pad', 7, 'LEFT', '_').should.equal('pad____');
pad('pad', 7, 'BOTH', '_').should.equal('__pad__');

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    3
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i node-string-pad

Weekly Downloads

3

Version

0.0.4

License

BSD

Last publish

Collaborators

  • netcell