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

x/ayonli_jsext/string/index.ts>chunk

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

Breaks the string into smaller chunks according to the given length.

Examples

Example 1

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

console.log(chunk("hello world", 3)); // ["hel", "lo ", "wor", "ld"]

Parameters

str: string
length: number

Returns

string[]