Gathering detailed insights and metrics for pad
Gathering detailed insights and metrics for pad
Gathering detailed insights and metrics for pad
Gathering detailed insights and metrics for pad
npm install pad
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (67.02%)
JavaScript (32.98%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
BSD-3-Clause License
42 Stars
164 Commits
13 Forks
3 Watchers
1 Branches
7 Contributors
Updated on Oct 15, 2024
Latest Version
3.3.0
Package Id
pad@3.3.0
Unpacked Size
58.43 kB
Size
12.84 kB
File Count
8
NPM Version
10.8.2
Node Version
20.17.0
Published on
Sep 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
31
1
Node Pad is a simple and elegant function to pad strings in both left and right directions. It is written in Typescript and it support both CommonJS and ESM.
The API is quite simple:
1import pad from "pad"; 2// Or const pad = require("pad") 3pad("pad", 5); // "pad " 4pad(5, "pad"); // " pad" 5pad("pad", 5, "+"); // "pad++" 6pad(5, "pad", "+"); // "++pad"
For TypeScript users, the type definition files are located in "./lib/index.d.ts" and declared inside the "package.json" file.
Node Pad comes in multiple flavours depending on your target environment:
dist/pad.cjs.js
package.json
by the main
property and used by default with require("pad")
in a Node.js environment.dist/pad.esm.js
package.json
by the module
property for ESM-aware tools like Rollup and webpack 2+.The CommonJS syntax to import Node Pad is:
1const pad = require("pad/dist/pad.cjs.js"); 2// Or simply 3const pad = require("pad");
While the ES Modules syntax is:
1import pad from "pad/dist/pad.esm.js"; 2// Or for ESM-aware tools 3import pad from "pad";
Options are provided as a third argument and are all optional. A string argument it is interpreted as the "char" option. Accepted options include:
char
(string)colors
(boolean)require 'pad/lib/colors'
to avoid passing this option.strip
(boolean)fixed_width
(boolean)wcwidth_options
(object)pad(length, text, [options])
Left padding occurs when the first argument is a number and the second argument is a string.
1import pad from "pad"; 2pad(5, "pad", "-").should.eql("--pad");
pad(text, length, [options])
Right padding occurs when the first argument is a string and the second argument is a number.
1import pad from "pad"; 2pad("pad", 6).should.eql("pad ");
Starting with version 1.1.0, Node 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:
1npm install pad
Via git (or downloaded tarball), copy or link the project from a discoverable Node.js directory:
1git clone http://github.com/adaltas/node-pad.git
Clone the repo, install the development dependencies and run the suite:
1git clone http://github.com/adaltas/node-pad.git . 2npm install 3make test
The project is sponsored by Adaltas based in Paris, France. Adaltas offers support and consulting on distributed systems, big data and open source.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More