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

Function empty

io/buffer_test.ts:60–75  ·  view source on GitHub ↗
(
  buf: Buffer,
  s: string,
  fub: Uint8Array,
)

Source from the content-addressed store, hash-verified

58// Empty buf through repeated reads into fub.
59// The initial contents of buf corresponds to the string s.
60async function empty(
61 buf: Buffer,
62 s: string,
63 fub: Uint8Array,
64) {
65 check(buf, s);
66 while (true) {
67 const r = await buf.read(fub);
68 if (r === null) {
69 break;
70 }
71 s = s.slice(r);
72 check(buf, s);
73 }
74 check(buf, "");
75}
76
77function repeat(c: string, bytes: number): Uint8Array {
78 assertEquals(c.length, 1);

Callers 1

buffer_test.tsFile · 0.85

Calls 3

checkFunction · 0.70
readMethod · 0.65
sliceMethod · 0.45

Tested by

no test coverage detected