New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

string-padding

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-padding - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

1

index.js
var pad = function(input, length, padding, side) {
input = (input || '').toString();
length = parseInt(length) || 0;

@@ -3,0 +4,0 @@ padding = (padding || '').toString() || ' ';

2

package.json
{
"name": "string-padding",
"version": "1.0.0",
"version": "1.0.1",
"description": "Pad strings/text",

@@ -5,0 +5,0 @@

@@ -14,14 +14,16 @@ # String-padding

- *string*: A string of text of any length.
- *length* (optional): The length the output string should be. Note that it doesn’t truncate the original string.
- *padding* (optional): The character(s) for padding. Yes, you could go crazy with multiple characters ;)
- *side* (optional): The side which should be padded; please use `pad.LEFT`, `pad.RIGHT` or `pad.BOTH`.
- **string**: A string of text of any length.
- **length** (optional): The length the output string should be. Note that it doesn’t truncate the original string.
- **padding** (optional): The character(s) for padding. Yes, you could go crazy with multiple characters ;)
- **side** (optional): The side which should be padded; please use `pad.LEFT`, `pad.RIGHT` or `pad.BOTH`.
For those who are totally fine with prototyping strings, you can do that. If you do, you can skip the first parameter.
var pad = require('string-padding');
String.prototype.pad = pad.prototype;
'Hello World!'.pad(16, '0'); // 0000Hello World!
```javascript
var pad = require('string-padding');
String.prototype.pad = pad.prototype;
'Hello World!'.pad(16, '0'); // 0000Hello World!
```
Happy padding! :)

Sorry, the diff of this file is not supported yet

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