Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/string/index.js>truncate

A JavaScript extension package for building strong and modern applications.
Latest
function truncate
import { truncate } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/string/index.js";

Truncates the string to the given length (including the ending ...).

Examples

Example 1

import { truncate } from "@ayonli/jsext/string";

console.log(truncate("hello world", 8)); // hello...
console.log(truncate("hello world", 11)); // hello world

Parameters

str
length