MCPcopy Create free account
hub / github.com/angular/dev-infra / bodyLength

Function bodyLength

github-actions/browserstack/set-browserstack-env.js:1319–1331  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

1317 return !!(obj != null && (typeof obj[Symbol.iterator] === "function" || typeof obj[Symbol.asyncIterator] === "function"));
1318 }
1319 function bodyLength(body) {
1320 if (body == null) {
1321 return 0;
1322 } else if (isStream(body)) {
1323 const state = body._readableState;
1324 return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) ? state.length : null;
1325 } else if (isBlobLike(body)) {
1326 return body.size != null ? body.size : null;
1327 } else if (isBuffer(body)) {
1328 return body.byteLength;
1329 }
1330 return null;
1331 }
1332 function isDestroyed(body) {
1333 var _a;
1334 return body && !!(body.destroyed || body[kDestroyed] || ((_a = stream.isDestroyed) == null ? void 0 : _a.call(stream, body)));

Callers 1

wrapRequestBodyFunction · 0.70

Calls 3

isStreamFunction · 0.70
isBlobLikeFunction · 0.70
isBufferFunction · 0.70

Tested by

no test coverage detected