UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

27 lines (25 loc) 894 B
import { Slice } from "string-ts"; //#region src/string/slice.d.ts /** * `slice(target, start, end?)` * * Extracts a section of `target` string from `start` index to `end` index (exclusive). If `end` is not provided, extracts to the end of the string. * * ```ts * slice("hello world", 0, 5); // "hello" * slice("hello world", 6, 11); // "world" * slice("hello world", 6); // "world" * ``` * * ```ts * pipe("hello world", slice(0, 5)); // "hello" * pipe("hello world", slice(6, 11)); // "world" * pipe("hello world", slice(6)); // "world" * ``` */ declare const slice$1: { <T extends string, U extends number, V extends number | undefined = undefined>(start: U, end?: V): (target: T) => Slice<T, U, V>; <T extends string, U extends number, V extends number | undefined = undefined>(target: T, start: U, end?: V): Slice<T, U, V>; }; //#endregion export { slice$1 as slice };