MCPcopy Create free account
hub / github.com/TruthHun/BookStack / howMuchToRead

Function howMuchToRead

static/word2md/mammoth.browser.js:24429–24445  ·  view source on GitHub ↗
(n, state)

Source from the content-addressed store, hash-verified

24427// This function is designed to be inlinable, so please take care when making
24428// changes to the function body.
24429function howMuchToRead(n, state) {
24430 if (n <= 0 || state.length === 0 && state.ended) return 0;
24431 if (state.objectMode) return 1;
24432 if (n !== n) {
24433 // Only flow one buffer at a time
24434 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
24435 }
24436 // If we're asking for more than the current hwm, then raise the hwm.
24437 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
24438 if (n <= state.length) return n;
24439 // Don't have enough
24440 if (!state.ended) {
24441 state.needReadable = true;
24442 return 0;
24443 }
24444 return state.length;
24445}
24446
24447// you can override either this method, or the async _read(n) below.
24448Readable.prototype.read = function (n) {

Callers 1

mammoth.browser.jsFile · 0.70

Calls 1

computeNewHighWaterMarkFunction · 0.70

Tested by

no test coverage detected