UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

24 lines (22 loc) 464 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/string/drop.ts /** * `drop(target, amount)` * * Removes the first `amount` characters from `target` string. * * ```ts * drop("hello world", 6); // "world" * ``` * * ```ts * pipe("hello world", drop(6)); // "world" * ``` */ const drop = dfdlT((target, amount) => { if (amount === 0) return target; if (amount >= target.length) return ""; return target.slice(amount); }, 2); //#endregion export { drop };