Socket
Socket
Sign inDemoInstall

pad

Package Overview
Dependencies
1
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pad

Left and right string padding


Version published
Weekly downloads
221K
increased by5.71%
Maintainers
1
Install size
394 kB
Created
Weekly downloads
 

Readme

Source
 _   _           _        _____          _ 
| \ | |         | |      |  __ \        | |
|  \| | ___   __| | ___  | |__) |_ _  __| |
| . ` |/ _ \ / _` |/ _ \ |  ___/ _` |/ _` |
| |\  | (_) | (_| |  __/ | |  | (_| | (_| |
|_| \_|\___/ \__,_|\___| |_|   \__,_|\__,_| 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

Keywords

FAQs

Last updated on 14 Nov 2011

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc