(n, state)
| 5682 | // This function is designed to be inlinable, so please take care when making |
| 5683 | // changes to the function body. |
| 5684 | function 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 |
no test coverage detected