Socket
Socket
Sign inDemoInstall

string-pad-start-x

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-pad-start-x

Pads a string with another string (repeated, if needed).


Version published
Maintainers
1
Created
Source

Travis status Dependency status devDependency status npm version

string-pad-start-x

Pads a string with another string (repeated, if needed).

Version: 1.2.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exports(string, targetLength, [padString])string

This method pads the current string with another string (repeated, if needed) so that the resulting string reaches the given length. The padding is applied from the start (left) of the current string.

Kind: Exported function
Returns: string - A String of the specified length with the pad string applied from the start.
Throws:

  • TypeError If target is null or undefined.
ParamTypeDescription
stringstringThe string to pad.
targetLengthnumberThe length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is.
[padString]stringThe string to pad the current string with. If this string is too long to stay within the target length, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020).

Example

var padStart = require('string-pad-start-x');

padStart('a', 3, 'b'); // 'bba'
padStart('a', 3); // '  a'
padStart('a', 2, 'bc'); // 'ba'

Keywords

FAQs

Package last updated on 02 Nov 2017

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