Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

left-pad/left-pad

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
March 14, 2014 02:09
May 1, 2016 19:17
November 13, 2018 19:09
March 13, 2019 12:32
November 13, 2018 19:15
January 6, 2019 18:06
November 13, 2018 19:15

left-pad

String left pad

Build Status

Install

$ npm install left-pad

Usage

const leftPad = require('left-pad')

leftPad('foo', 5)
// => "  foo"

leftPad('foobar', 6)
// => "foobar"

leftPad(1, 2, '0')
// => "01"

leftPad(17, 5, 0)
// => "00017"

NOTE: The third argument should be a single char. However the module doesn't throw an error if you supply more than one chars. See #28.

NOTE: Characters having code points outside of BMP plane are considered two distinct characters. See #58.