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

Method transform

encoding/_random_slice_stream.ts:13–17  ·  view source on GitHub ↗
(chunk, controller)

Source from the content-addressed store, hash-verified

11 constructor() {
12 super({
13 transform(chunk, controller) {
14 const i = Math.floor(Math.random() * chunk.length);
15 controller.enqueue(chunk.slice(0, i) as T);
16 controller.enqueue(chunk.slice(i) as T);
17 },
18 });
19 }
20}

Callers

nothing calls this directly

Calls 2

floorMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected