Key features
Simple API
Light weight, 1 dependency
CJS, ESM and UMD bundles
Documented and tested
Well tested, mature
MIT License
Installing
Starting with version 1.1.0, Node.js PAD rely on Node.js 4.0.0 or more recent. Stick to version 1.0.x if using an older version of Node.js.
Via npm:
npm install pad
Via git (or downloaded tarball), copy or link the project from a discoverable Node.js directory:
git clone http://github.com/wdavidw/node-pad.git
Getting started
The API is quite simple:
const pad = require('pad')
pad('pad', 5) // "pad "
pad(5, 'pad') // " pad"
pad('pad', 5, '+') // "pad++"
pad(5, 'pad', '+') // "++pad"
For TypeScript users, the type definition file is located in "./lib/index.d.ts" and declared inside the "package.json" file.
Bundles in multiple formats are available: CommonJS, ESM and UMD. Node.js and ESM-aware tools will automatically discover the appropriate bundle format from the `package.json` declaration file.