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

x/ayonli_jsext/uint8array/index.ts>split

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

Breaks the byte array into smaller chunks according to the given delimiter.

Examples

Example 1

import { split } from "@ayonli/jsext/bytes";

const arr = new Uint8Array([1, 2, 3, 0, 4, 5, 0, 6, 7]);

console.log(split(arr, 0));
// [
//     Uint8Array(3) [ 1, 2, 3 ],
//     Uint8Array(2) [ 4, 5 ],
//     Uint8Array(2) [ 6, 7 ]
// ]

Type Parameters

T extends Uint8Array

Parameters

arr: T
delimiter: number