Returns a new byte slice composed of count repetitions of the source array.
count
source
Source array to repeat.
Number of times to repeat the source array.
A new byte slice composed of count repetitions of the source array.
import { repeat } from "@std/bytes/repeat";import { assertEquals } from "@std/assert";const source = new Uint8Array([0, 1, 2]);assertEquals(repeat(source, 3), new Uint8Array([0, 1, 2, 0, 1, 2, 0, 1, 2])); Copy
import { repeat } from "@std/bytes/repeat";import { assertEquals } from "@std/assert";const source = new Uint8Array([0, 1, 2]);assertEquals(repeat(source, 3), new Uint8Array([0, 1, 2, 0, 1, 2, 0, 1, 2]));
import { repeat } from "@std/bytes/repeat";import { assertEquals } from "@std/assert";const source = new Uint8Array([0, 1, 2]);assertEquals(repeat(source, 0), new Uint8Array()); Copy
import { repeat } from "@std/bytes/repeat";import { assertEquals } from "@std/assert";const source = new Uint8Array([0, 1, 2]);assertEquals(repeat(source, 0), new Uint8Array());
Returns a new byte slice composed of
countrepetitions of thesourcearray.