JSPM

  • Created
  • Published
  • Downloads 245026
  • Score
    100M100P100Q155604F

Left and right string padding

Package Exports

  • pad

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 (pad) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

 _   _           _        _____          _ 
| \ | |         | |      |  __ \        | |
|  \| | ___   __| | ___  | |__) |_ _  __| |
| . ` |/ _ \ / _` |/ _ \ |  ___/ _` |/ _` |
| |\  | (_) | (_| |  __/ | |  | (_| | (_| |
|_| \_|\___/ \__,_|\___| |_|   \__,_|\__,_| New BSD License

Node Pad is a simple function to pad strings in the left and right directions.

pad(text, size, [char]): Left padding

Node Pad does left padding when the first argument is a string and the second argument is a number.

var pad = require('pad');
pad('pad', 6).should.eql('pad   ');

pad(size, text, [char]): Right padding

Node Pad does right padding when the first argument is a number and the second argument is a string.

var pad = require('pad');
pad(5, 'pad', '--').should.eql('--pad');

Installing

Via git (or downloaded tarball), copy or link the project from a discoverable Node directory:

git clone http://github.com/wdavidw/node-pad.git

Via npm:

npm install pad

Testing

Clone the repo, install the development dependencies and run the suite:

git clone http://github.com/wdavidw/node-pad.git .
npm install
make test