JSPM

  • Created
  • Published
  • Downloads 253098
  • Score
    100M100P100Q167778F

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.

Left padding

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

var assert = require('assert');
var pad = require('pad');
assert.equal('pad   ', pad('pad', 6));

Right padding

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

var assert = require('assert');
var pad = require('pad');
assert.equal( '  pad', pad(5, 'pad'));

Installing

Via git (or downloaded tarball):

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

Then, simply copy or link the project inside a discoverable Node directory (node_modules).

Via npm:

$ npm install pad