
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Behold, a far superior alternative to left-pad.
Inserts padding to the West of a string.
npm install west-pad
type Direction = "N" | "S" | "E" | "W" | number;
import WestPad from 'west-pad';
const direction = getDeviceDirection(); // "N" or 0
const westPad = new WestPad(direction);
const s = "Hello World";
console.log(westPad(s)); // " Hello World"
console.log(westPad(s, 5)); // " Hello World"
console.log(westPad(s, 5, "+")); // "+++++Hello World"
const newDirection = "E";
westPad.updateDirection(newDirection);
console.log(westPad(s, 2)); // "Hello World\n \n"
import { westPad } from 'west-pad';
const direction = getDeviceDirection(); // "N"
const s = "Hello World";
console.log(westPad(direction, s, 3)); // " Hello World"
console.log(westPad("S", s, 3, "+")); // "Hello World+++"
console.log(westPad(220, s, 3)); // " \n \n \nHello World"
Don't worry, west-pad has you covered. There is both a class method and a standalone function for you East-ers!
import WestPad from 'west-pad';
const direction = "N";
const s = "Hello World";
const westPad = new WestPad(direction);
const paddedEastFromMethod = westPad.turnAroundThenPad(s, 3);
console.log(paddedEastFromMethod); // "Hello World "
import { notWestPad } from 'west-pad';
const direction = "N";
const s = "Hello World";
const paddedEast = notWestPad(direction, s, 3);
console.log(paddedEast); // "Hello World "
Padding is being added in the wrong direction?
Step 1. Try turning your computer/device in a different direction.
Step 2. Profit
constructor| Param | Type | Required | Description |
|---|---|---|---|
| direction | Direction or number | yes | "N", "S", "E" or "W", or a number representing degrees from North |
updateDirection| Param | Type | Required | Description |
|---|---|---|---|
| direction | Direction or number | yes | "N", "S", "E" or "W", or a number representing degrees from North |
pad| Param | Type | Required | Description |
|---|---|---|---|
| s | string | yes | the target string to pad |
| multiplicand | number | no; default = 1 | the number of times parameter p will be padded |
| p | string | no; default = " " | the string that will pad target string s multiplicand times |
turnAroundThenPad| Param | Type | Required | Description |
|---|---|---|---|
| s | string | yes | the target string to pad |
| multiplicand | number | no; default = 1 | the number of times parameter p will be padded |
| p | string | no; default = " " | the string that will pad target string s multiplicand times |
westPad| Param | Type | Required | Description |
|---|---|---|---|
| direction | Direction or number | yes | "N", "S", "E" or "W", or a number representing degrees from North |
| s | string | yes | the target string to pad |
| multiplicand | number | no; default = 1 | the number of times parameter p will be padded |
| p | string | no; default = " " | the string that will pad target string s multiplicand times |
notWestPad| Param | Type | Required | Description |
|---|---|---|---|
| direction | Direction or number | yes | "N", "S", "E" or "W", or a number representing degrees from North |
| s | string | yes | the target string to pad |
| multiplicand | number | no; default = 1 | the number of times parameter p will be padded |
| p | string | no; default = " " | the string that will pad target string s multiplicand times |
FAQs
a better left-pad: adds padding in the West cardinal direction
The npm package west-pad receives a total of 8 weekly downloads. As such, west-pad popularity was classified as not popular.
We found that west-pad demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.