MCPcopy Index your code
hub / github.com/deployd/deployd / serializeStream

Function serializeStream

test-app/public/sinon.js:6567–6591  ·  view source on GitHub ↗

* @param {!Array. } stream * @return {string} * @this {TextDecoder}

(stream)

Source from the content-addressed store, hash-verified

6565 * @this {TextDecoder}
6566 */
6567 function serializeStream(stream) {
6568 // 1. Let token be the result of reading from stream.
6569 // (Done in-place on array, rather than as a stream)
6570
6571 // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore
6572 // BOM flag and BOM seen flag are unset, run these subsubsteps:
6573 if (includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) &&
6574 !this._ignoreBOM && !this._BOMseen) {
6575 if (stream.length > 0 && stream[0] === 0xFEFF) {
6576 // 1. If token is U+FEFF, set BOM seen flag.
6577 this._BOMseen = true;
6578 stream.shift();
6579 } else if (stream.length > 0) {
6580 // 2. Otherwise, if token is not end-of-stream, set BOM seen
6581 // flag and append token to stream.
6582 this._BOMseen = true;
6583 } else {
6584 // 3. Otherwise, if token is not end-of-stream, append token
6585 // to output.
6586 // (no-op)
6587 }
6588 }
6589 // 4. Otherwise, return output.
6590 return codePointsToString(stream);
6591 }
6592
6593 return serializeStream.call(this, output);
6594 };

Callers

nothing calls this directly

Calls 2

includesFunction · 0.85
codePointsToStringFunction · 0.85

Tested by

no test coverage detected