@monstermann/fn
Version:
A utility library for TypeScript.
22 lines (20 loc) • 488 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/string/padStart.ts
/**
* `padStart(target, length, fill)`
*
* Pads `target` string from the start with `fill` string until the result reaches the specified `length`.
*
* ```ts
* padStart("hello", 10, " "); // " hello"
* ```
*
* ```ts
* pipe("hello", padStart(10, " ")); // " hello"
* ```
*/
const padStart = dfdlT((target, length, fill) => {
return target.padStart(length, fill);
}, 3);
//#endregion
export { padStart };