Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/rimbu/typical/mod.ts>Str.Take

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias Str.Take
import { type Str } from "https://deno.land/x/rimbu@1.0.2/typical/mod.ts";
const { Take } = Str;

Returns the first N characters of the given string, or the given string if it does not have enough characters.

Examples

Example 1

Take<'abcd', 2> => 'ab'
Take<'abcd', 5> => 'abcd'

Type Parameters

S extends string
N extends number
definition: TakeHelper<S, N, "">