import { repeat } from "https://deno.land/x/embassyd_sdk@v0.3.4.0.0-alpha2/lib/esm/deps/deno.land/std@0.140.0/bytes/mod.js";
Returns a new Uint8Array composed of count
repetitions of the source
array.
If count
is negative, a RangeError
is thrown.
import { repeat } from "./mod.ts";
const source = new Uint8Array([0, 1, 2]);
console.log(repeat(source, 3)); // [0, 1, 2, 0, 1, 2, 0, 1, 2]
console.log(repeat(source, 0)); // []
console.log(repeat(source, -1)); // RangeError