MCPcopy Create free account
hub / github.com/denoland/std / repeat

Function repeat

bytes/repeat.ts:36–49  ·  view source on GitHub ↗
(source: Uint8Array, count: number)

Source from the content-addressed store, hash-verified

34 * ```
35 */
36export function repeat(source: Uint8Array, count: number): Uint8Array_ {
37 if (count < 0 || !Number.isInteger(count)) {
38 throw new RangeError("Count must be a non-negative integer");
39 }
40
41 const repeated = new Uint8Array(source.length * count);
42 let offset = 0;
43
44 while (offset < repeated.length) {
45 offset += copy(source, repeated, offset);
46 }
47
48 return repeated;
49}

Callers 2

repeat_test.tsFile · 0.90
crypto_test.tsFile · 0.90

Calls 1

copyFunction · 0.90

Tested by

no test coverage detected