MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / partition

Function partition

packages/baseai/src/dev/utils/stream/stream.ts:490–501  ·  view source on GitHub ↗
(str: string, delimiter: string)

Source from the content-addressed store, hash-verified

488}
489
490function partition(str: string, delimiter: string): [string, string, string] {
491 const index = str.indexOf(delimiter);
492 if (index !== -1) {
493 return [
494 str.substring(0, index),
495 delimiter,
496 str.substring(index + delimiter.length)
497 ];
498 }
499
500 return [str, '', ''];
501}
502
503/**
504 * Most browsers don't yet have async iterable support for ReadableStream,

Callers 1

decodeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected