Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pad-left

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pad-left

Left pad a string with zeros or a specified string. Fastest implementation.

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
144K
decreased by-27.06%
Maintainers
1
Weekly downloads
 
Created

What is pad-left?

The pad-left npm package is a utility that allows you to pad the left side of a string with a specified character or set of characters until the string reaches a desired length. This can be useful for formatting output, aligning text, or ensuring consistent string lengths.

What are pad-left's main functionalities?

Basic Padding

Pads the left side of the string '123' with spaces until the total length is 5.

const padLeft = require('pad-left');
const result = padLeft('123', 5);
console.log(result); // '  123'

Custom Padding Character

Pads the left side of the string '123' with the character '0' until the total length is 5.

const padLeft = require('pad-left');
const result = padLeft('123', 5, '0');
console.log(result); // '00123'

Padding with Multiple Characters

Pads the left side of the string '123' with the string 'abc' repeated until the total length is 7.

const padLeft = require('pad-left');
const result = padLeft('123', 7, 'abc');
console.log(result); // 'abca123'

Other packages similar to pad-left

Keywords

FAQs

Package last updated on 27 Apr 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc