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

Function fromList

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

Source from the content-addressed store, hash-verified

24962// This function is designed to be inlinable, so please take care when making
24963// changes to the function body.
24964function fromList(n, state) {
24965 // nothing buffered
24966 if (state.length === 0) return null;
24967
24968 var ret;
24969 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
24970 // read it all, truncate the list
24971 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
24972 state.buffer.clear();
24973 } else {
24974 // read part of list
24975 ret = fromListPartial(n, state.buffer, state.decoder);
24976 }
24977
24978 return ret;
24979}
24980
24981// Extracts only enough buffered data to satisfy the amount requested.
24982// This function is designed to be inlinable, so please take care when making

Callers 1

mammoth.browser.jsFile · 0.70

Calls 1

fromListPartialFunction · 0.70

Tested by

no test coverage detected