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

x/capi/deps/std/bytes.ts>repeat

[WIP] A framework for crafting interactions with Substrate chains
Latest
function repeat
import { repeat } from "https://deno.land/x/capi@v0.1.1-beta.1/deps/std/bytes.ts";

Returns a new Uint8Array composed of count repetitions of the source array.

If count is negative, a RangeError is thrown.

import { repeat } from "https://deno.land/std@0.224.0/bytes/repeat.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

Parameters

source: Uint8Array
count: number

Returns

Uint8Array