MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / fromList

Function fromList

lib/models/dav.js:5684–5699  ·  view source on GitHub ↗
(n, state)

Source from the content-addressed store, hash-verified

5682// This function is designed to be inlinable, so please take care when making
5683// changes to the function body.
5684function fromList(n, state) {
5685 // nothing buffered
5686 if (state.length === 0) return null;
5687
5688 var ret;
5689 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
5690 // read it all, truncate the list
5691 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);
5692 state.buffer.clear();
5693 } else {
5694 // read part of list
5695 ret = fromListPartial(n, state.buffer, state.decoder);
5696 }
5697
5698 return ret;
5699}
5700
5701// Extracts only enough buffered data to satisfy the amount requested.
5702// This function is designed to be inlinable, so please take care when making

Callers 1

dav.jsFile · 0.85

Calls 2

fromListPartialFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected