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

Function fromListPartial

static/word2md/mammoth.browser.js:24984–24998  ·  view source on GitHub ↗
(n, list, hasStrings)

Source from the content-addressed store, hash-verified

24982// This function is designed to be inlinable, so please take care when making
24983// changes to the function body.
24984function fromListPartial(n, list, hasStrings) {
24985 var ret;
24986 if (n < list.head.data.length) {
24987 // slice is the same for buffers and strings
24988 ret = list.head.data.slice(0, n);
24989 list.head.data = list.head.data.slice(n);
24990 } else if (n === list.head.data.length) {
24991 // first chunk is a perfect match
24992 ret = list.shift();
24993 } else {
24994 // result spans more than one buffer
24995 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
24996 }
24997 return ret;
24998}
24999
25000// Copies a specified amount of characters from the list of buffered data
25001// chunks.

Callers 1

fromListFunction · 0.70

Calls 2

copyFromBufferStringFunction · 0.70
copyFromBufferFunction · 0.70

Tested by

no test coverage detected