1.1.0 • Published 2 years ago

@leftpad-rs/core v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

leftpad-rs

Why bother making your own left padding function in like 2 minutes when you can instead download this awesome library that gives you the most 🔥 blazingly fast 🔥 left-padding code out there. Want to use TypeScript? You can! thanks to the amazing work the folks over at napi-rs do!

If you haven't already, first install Rust, since this package relies on a rust binary to deliver those indredulously quick leftpads.

Install this package like so:

npm install @leftpad-rs/core

To use it, simply write:

import { leftpad } from "@leftpad-rs/core";

console.log(leftpad("Hello World!", 5));
//     Hello World!

The function takes in three arguments:

  • input (required): The string to leftpad
  • length (required): The number of spaces to leftpad by, must be a positive number
  • pattern: The pattern to repeat by, default is a whitespace " ", can be any string